diff options
author | dim <dim@FreeBSD.org> | 2012-08-15 20:02:54 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-08-15 20:02:54 +0000 |
commit | 554bcb69c2d785a011a30e7db87a36a87fe7db10 (patch) | |
tree | 9abb1a658a297776086f4e0dfa6ca533de02104e /test/SemaCXX/conditional-expr.cpp | |
parent | bb67ca86b31f67faee50bd10c3b036d65751745a (diff) | |
download | FreeBSD-src-554bcb69c2d785a011a30e7db87a36a87fe7db10.zip FreeBSD-src-554bcb69c2d785a011a30e7db87a36a87fe7db10.tar.gz |
Vendor import of clang trunk r161861:
http://llvm.org/svn/llvm-project/cfe/trunk@161861
Diffstat (limited to 'test/SemaCXX/conditional-expr.cpp')
-rw-r--r-- | test/SemaCXX/conditional-expr.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp index 4aee913..a80eda4 100644 --- a/test/SemaCXX/conditional-expr.cpp +++ b/test/SemaCXX/conditional-expr.cpp @@ -2,7 +2,7 @@ // C++ rules for ?: are a lot stricter than C rules, and have to take into // account more conversion options. -// This test runs in C++0x mode for the contextual conversion of the condition. +// This test runs in C++11 mode for the contextual conversion of the condition. struct ToBool { explicit operator bool(); }; @@ -328,3 +328,27 @@ namespace PR9236 { (void)(true ? (void*)0 : A()); // expected-error{{incompatible operand types}} } } + +namespace DR587 { + template<typename T> + const T *f(bool b) { + static T t1 = T(); + static const T t2 = T(); + return &(b ? t1 : t2); + } + struct S {}; + template const int *f(bool); + template const S *f(bool); + + extern bool b; + int i = 0; + const int ci = 0; + volatile int vi = 0; + const volatile int cvi = 0; + + const int &cir = b ? i : ci; + volatile int &vir = b ? vi : i; + const volatile int &cvir1 = b ? ci : cvi; + const volatile int &cvir2 = b ? cvi : vi; + const volatile int &cvir3 = b ? ci : vi; // expected-error{{volatile lvalue reference to type 'const volatile int' cannot bind to a temporary of type 'int'}} +} |