diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-10-31 05:52:43 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-10-31 05:52:43 +0000 |
commit | bd552efbeff3a64a1c400d2bba18f13f84abd8ab (patch) | |
tree | 372fab310619f848e9d784c121790f7b895bc433 /test | |
parent | 9e36b533af1b2fa9f32c4372c4081abdd86f47e0 (diff) |
C++11 generalized constant expression handling: evaluation support for
materialized temporaries.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143335 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/SemaCXX/constant-expression-cxx11.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/SemaCXX/constant-expression-cxx11.cpp b/test/SemaCXX/constant-expression-cxx11.cpp index b02253cf45..4c662a06cc 100644 --- a/test/SemaCXX/constant-expression-cxx11.cpp +++ b/test/SemaCXX/constant-expression-cxx11.cpp @@ -203,3 +203,19 @@ using check = int[m1 + (m2<<1) + (m3<<2) + (m4<<3) + (m5<<4) + (m6<<5) + using check = int[2+4+16+128+512+2048+4096+16384+32768]; } + +namespace MaterializeTemporary { + +constexpr int f(const int &r) { return r; } +constexpr int n = f(1); + +constexpr bool same(const int &a, const int &b) { return &a == &b; } +constexpr bool sameTemporary(const int &n) { return same(n, n); } + +using check_value = int[1]; +using check_value = int[n]; +using check_value = int[!same(4, 4)]; +using check_value = int[same(n, n)]; +using check_value = int[sameTemporary(9)]; + +} |