diff options
author | John McCall <rjmccall@apple.com> | 2011-06-27 21:24:11 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-06-27 21:24:11 +0000 |
commit | e6d134b244cd666c47a3d2dd78f82ff0824188bd (patch) | |
tree | 4fe3759627ae12c12b914485f026ff266120d85b /lib/Sema/SemaExprCXX.cpp | |
parent | 239cad79cb5be7a0b29f9e0883203695d40079a8 (diff) |
Fix PR10204 in a better way.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133943 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index f8da76bf84..c6443e988b 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -4461,7 +4461,16 @@ ExprResult Sema::IgnoredValueConversions(Expr *E) { // [Except in specific positions,] an lvalue that does not have // array type is converted to the value stored in the // designated object (and is no longer an lvalue). - if (E->isRValue()) return Owned(E); + if (E->isRValue()) { + // In C, function designators (i.e. expressions of function type) + // are r-values, but we still want to do function-to-pointer decay + // on them. This is both technically correct and convenient for + // some clients. + if (!getLangOptions().CPlusPlus && E->getType()->isFunctionType()) + return DefaultFunctionArrayConversion(E); + + return Owned(E); + } // We always want to do this on ObjC property references. if (E->getObjectKind() == OK_ObjCProperty) { |