diff options
author | dim <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
commit | 39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df (patch) | |
tree | a9243275843fbeaa590afc07ee888e006b8d54ea /test/SemaCXX/conditional-expr.cpp | |
parent | 69b4eca4a4255ba43baa5c1d9bbdec3ec17f479e (diff) | |
download | FreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.zip FreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.tar.gz |
Vendor import of clang trunk r126079:
http://llvm.org/svn/llvm-project/cfe/trunk@126079
Diffstat (limited to 'test/SemaCXX/conditional-expr.cpp')
-rw-r--r-- | test/SemaCXX/conditional-expr.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp index 065179b..1da9a17 100644 --- a/test/SemaCXX/conditional-expr.cpp +++ b/test/SemaCXX/conditional-expr.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x -Wsign-compare %s +// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify -std=c++0x -Wsign-compare %s // C++ rules for ?: are a lot stricter than C rules, and have to take into // account more conversion options. @@ -7,7 +7,10 @@ struct ToBool { explicit operator bool(); }; struct B; -struct A { A(); A(const B&); }; // expected-note 2 {{candidate constructor}} +struct A { + A(); + A(const B&); // expected-note 2 {{candidate constructor}} +}; struct B { operator A() const; }; // expected-note 2 {{candidate function}} struct I { operator int(); }; struct J { operator I(); }; @@ -106,8 +109,8 @@ void test() i1 = (i1 ? Base() : Derived()).trick(); i1 = (i1 ? Derived() : Base()).trick(); // should fail: const lost - (void)(i1 ? Base() : constder()); // expected-error {{incompatible operand types ('Base' and 'Derived const')}} - (void)(i1 ? constder() : Base()); // expected-error {{incompatible operand types ('Derived const' and 'Base')}} + (void)(i1 ? Base() : constder()); // expected-error {{incompatible operand types ('Base' and 'const Derived')}} + (void)(i1 ? constder() : Base()); // expected-error {{incompatible operand types ('const Derived' and 'Base')}} Priv priv; Fin fin; @@ -304,3 +307,17 @@ namespace PR7598 { } } + +namespace PR9236 { +#define NULL 0L + void f() { + int i; + (void)(true ? A() : NULL); // expected-error{{non-pointer operand type 'A' incompatible with NULL}} + (void)(true ? NULL : A()); // expected-error{{non-pointer operand type 'A' incompatible with NULL}} + (void)(true ? 0 : A()); // expected-error{{incompatible operand types}} + (void)(true ? nullptr : A()); // expected-error{{non-pointer operand type 'A' incompatible with nullptr}} + (void)(true ? nullptr : i); // expected-error{{non-pointer operand type 'int' incompatible with nullptr}} + (void)(true ? __null : A()); // expected-error{{non-pointer operand type 'A' incompatible with NULL}} + (void)(true ? (void*)0 : A()); // expected-error{{incompatible operand types}} + } +} |