diff options
author | dim <dim@FreeBSD.org> | 2011-07-17 15:40:56 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-07-17 15:40:56 +0000 |
commit | 611ba3ea3300b71eb95dc4e45f20eee5dddd32e1 (patch) | |
tree | 2097d084eb235c0b12c0bff3445f4ec7bbaa8a12 /test/SemaCXX/expressions.cpp | |
parent | c49018d9cce52d8c9f34b44865ec3ba8e89a1488 (diff) | |
download | FreeBSD-src-611ba3ea3300b71eb95dc4e45f20eee5dddd32e1.zip FreeBSD-src-611ba3ea3300b71eb95dc4e45f20eee5dddd32e1.tar.gz |
Vendor import of clang trunk r135360:
http://llvm.org/svn/llvm-project/cfe/trunk@135360
Diffstat (limited to 'test/SemaCXX/expressions.cpp')
-rw-r--r-- | test/SemaCXX/expressions.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/SemaCXX/expressions.cpp b/test/SemaCXX/expressions.cpp index 95ece48..8a294fa 100644 --- a/test/SemaCXX/expressions.cpp +++ b/test/SemaCXX/expressions.cpp @@ -63,3 +63,25 @@ int test2(int x) { return x && (-1); // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} return x && (5); // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} } + +template<unsigned int A, unsigned int B> struct S +{ + enum { + e1 = A && B, + e2 = A && 7 // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} + }; + + int foo() { + int x = A && B; + int y = B && 3; // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} + + return x + y; + } +}; + +void test3() { + S<5, 8> s1; + S<2, 7> s2; + (void)s1.foo(); + (void)s2.foo(); +} |