summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/block-return.c
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-07-13 08:18:22 +0000
committerDouglas Gregor <dgregor@apple.com>2010-07-13 08:18:22 +0000
commit603d81bf8d055732b3ba24899dd9c443e1ef243b (patch)
treeddea48df7318af2c406d98e6bbeee74b066139ae /clang/test/Sema/block-return.c
parentd8f446f1b2dbe66cfa30335b60d6217fef684811 (diff)
downloadbcm5719-llvm-603d81bf8d055732b3ba24899dd9c443e1ef243b.tar.gz
bcm5719-llvm-603d81bf8d055732b3ba24899dd9c443e1ef243b.zip
When forming a function call or message send expression, be sure to
strip cv-qualifiers from the expression's type when the language calls for it: in C, that's all the time, while C++ only does it for non-class types. Centralized the computation of the call expression type in QualType::getCallResultType() and some helper functions in other nodes (FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant callers of getResultType() to getCallResultType(). Fixes PR7598 and PR7463, along with a bunch of getResultType() call sites that weren't stripping references off the result type (nothing stripped cv-qualifiers properly before this change). llvm-svn: 108234
Diffstat (limited to 'clang/test/Sema/block-return.c')
-rw-r--r--clang/test/Sema/block-return.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/test/Sema/block-return.c b/clang/test/Sema/block-return.c
index 10b3b8480cc..33fd183be06 100644
--- a/clang/test/Sema/block-return.c
+++ b/clang/test/Sema/block-return.c
@@ -109,8 +109,11 @@ void foo6() {
void foo7()
{
- const int (^BB) (void) = ^{ const int i = 1; return i; }; // expected-error{{incompatible block pointer types initializing 'int const (^)(void)' with an expression of type 'int (^)(void)'}}
- const int (^CC) (void) = ^const int{ const int i = 1; return i; }; // OK
+ const int (^BB) (void) = ^{ const int i = 1; return i; }; // expected-error{{incompatible block pointer types initializing 'int const (^)(void)' with an expression of type 'int (^)(void)'}} \
+ // expected-warning{{type qualifier on return type has no effect}}
+
+ const int (^CC) (void) = ^const int{ const int i = 1; return i; }; // expected-warning{{type qualifier on return type has no effect}}
+
int i;
int (^FF) (void) = ^{ return i; }; // OK
OpenPOWER on IntegriCloud