diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-18 04:58:18 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-18 04:58:18 +0000 |
commit | 0dea49e324ecb836ddad859495bde8ffc48a8ae0 (patch) | |
tree | f0626326c7527bf769f515f9575068e3ad57fb29 /clang/test | |
parent | ff4b40700996235098d8fa347a919a4fe808f057 (diff) | |
download | bcm5719-llvm-0dea49e324ecb836ddad859495bde8ffc48a8ae0.tar.gz bcm5719-llvm-0dea49e324ecb836ddad859495bde8ffc48a8ae0.zip |
Fix a problem in the GCC testsuite, exposed by r150557. Compound literals
are represented as prvalues in C++; don't be fooled into thinking they're
global lvalues.
llvm-svn: 150870
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/SemaCXX/constant-expression-cxx11.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/constant-expression-cxx11.cpp b/clang/test/SemaCXX/constant-expression-cxx11.cpp index a048297bb5a..b7ba68890d9 100644 --- a/clang/test/SemaCXX/constant-expression-cxx11.cpp +++ b/clang/test/SemaCXX/constant-expression-cxx11.cpp @@ -1198,3 +1198,13 @@ namespace VLASizeof { * 3; } } + +namespace CompoundLiteral { + // FIXME: + // We don't model the semantics of this correctly: the compound literal is + // represented as a prvalue in the AST, but actually behaves like an lvalue. + // We treat the compound literal as a temporary and refuse to produce a + // pointer to it. This is OK: we're not required to treat this as a constant + // in C++, and in C we model compound literals as lvalues. + constexpr int *p = (int*)(int[1]){0}; // expected-warning {{C99}} expected-error {{constant expression}} expected-note 2{{temporary}} +} |