diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-07-15 17:07:12 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-07-15 17:07:12 +0000 |
commit | f1752835b9d5f0da31f34b18c9f1eb8dcb799ba8 (patch) | |
tree | 5e946d69177464379cb1a38ac18206180d763639 /test/SemaCXX | |
parent | 1928da94b55683957759d5c5ff4593a118773394 (diff) | |
download | FreeBSD-src-f1752835b9d5f0da31f34b18c9f1eb8dcb799ba8.zip FreeBSD-src-f1752835b9d5f0da31f34b18c9f1eb8dcb799ba8.tar.gz |
Update clang to r108428.
Diffstat (limited to 'test/SemaCXX')
-rw-r--r-- | test/SemaCXX/ambig-user-defined-conversions.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/bool.cpp | 4 | ||||
-rw-r--r-- | test/SemaCXX/conditional-expr.cpp | 4 | ||||
-rw-r--r-- | test/SemaCXX/cv-unqual-rvalues.cpp | 24 | ||||
-rw-r--r-- | test/SemaCXX/friend.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/return.cpp | 12 | ||||
-rw-r--r-- | test/SemaCXX/switch.cpp | 3 |
7 files changed, 43 insertions, 8 deletions
diff --git a/test/SemaCXX/ambig-user-defined-conversions.cpp b/test/SemaCXX/ambig-user-defined-conversions.cpp index 9811859..fdb399b 100644 --- a/test/SemaCXX/ambig-user-defined-conversions.cpp +++ b/test/SemaCXX/ambig-user-defined-conversions.cpp @@ -17,7 +17,7 @@ namespace test0 { void func(const char ci, const B b); // expected-note {{candidate function}} void func(const B b, const int ci); // expected-note {{candidate function}} - const int Test1() { // expected-warning{{type qualifier on return type has no effect}} + const int Test1() { func(b1, f()); // expected-error {{call to 'func' is ambiguous}} return f(); // expected-error {{conversion from 'test0::B' to 'int const' is ambiguous}} diff --git a/test/SemaCXX/bool.cpp b/test/SemaCXX/bool.cpp index 44e17ce..726fa6c 100644 --- a/test/SemaCXX/bool.cpp +++ b/test/SemaCXX/bool.cpp @@ -25,6 +25,6 @@ void static_assert_arg_is_bool(T x) { void test2() { int n = 2; - static_assert_arg_is_bool(n && 4); - static_assert_arg_is_bool(n || 5); + static_assert_arg_is_bool(n && 4); // expected-warning {{use of logical && with constant operand}} + static_assert_arg_is_bool(n || 5); // expected-warning {{use of logical || with constant operand}} } diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp index f37ccc8..065179b 100644 --- a/test/SemaCXX/conditional-expr.cpp +++ b/test/SemaCXX/conditional-expr.cpp @@ -288,11 +288,11 @@ namespace PR7598 { v = 1, }; - const Enum g() { // expected-warning{{type qualifier on return type has no effect}} + const Enum g() { return v; } - const volatile Enum g2() { // expected-warning{{'const volatile' type qualifiers on return type have no effect}} + const volatile Enum g2() { return v; } diff --git a/test/SemaCXX/cv-unqual-rvalues.cpp b/test/SemaCXX/cv-unqual-rvalues.cpp new file mode 100644 index 0000000..ed76ced --- /dev/null +++ b/test/SemaCXX/cv-unqual-rvalues.cpp @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// PR7463: Make sure that when we have an rvalue, it does not have +// cv-qualified non-class type. +template <typename T_> void g (T_&); // expected-note 7{{not viable}} + +template<const int X> void h() { + g(X); // expected-error{{no matching function for call to 'g'}} +} + +template<typename T, T X> void h2() { + g(X); // expected-error{{no matching function for call to 'g'}} +} + +void a(__builtin_va_list x) { + g(__builtin_va_arg(x, const int)); // expected-error{{no matching function for call to 'g'}} + g((const int)0); // expected-error{{no matching function for call to 'g'}} + typedef const int cint; + g(cint(0)); // expected-error{{no matching function for call to 'g'}} + g(static_cast<const int>(1)); // expected-error{{no matching function for call to 'g'}} + g(reinterpret_cast<int *const>(0)); // expected-error{{no matching function for call to 'g'}} + h<0>(); + h2<const int, 0>(); // expected-note{{instantiation of}} +} diff --git a/test/SemaCXX/friend.cpp b/test/SemaCXX/friend.cpp index 65e0da7..30abcbb 100644 --- a/test/SemaCXX/friend.cpp +++ b/test/SemaCXX/friend.cpp @@ -44,7 +44,7 @@ namespace test2 { // PR5134 namespace test3 { class Foo { - friend const int getInt(int inInt = 0); // expected-warning{{'const' type qualifier on return type has no effect}} + friend const int getInt(int inInt = 0); }; } diff --git a/test/SemaCXX/return.cpp b/test/SemaCXX/return.cpp index e682fdf..6bdbe52 100644 --- a/test/SemaCXX/return.cpp +++ b/test/SemaCXX/return.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -fsyntax-only -verify +// RUN: %clang_cc1 %s -fsyntax-only -Wignored-qualifiers -verify int test1() { throw; @@ -16,3 +16,13 @@ template<typename T> T h() { return 17; } + +// Don't warn on cv-qualified class return types, only scalar return types. +namespace ignored_quals { +struct S {}; +const S class_c(); +const volatile S class_cv(); + +const int scalar_c(); // expected-warning{{'const' type qualifier on return type has no effect}} +const volatile int scalar_cv(); // expected-warning{{'const volatile' type qualifiers on return type have no effect}} +} diff --git a/test/SemaCXX/switch.cpp b/test/SemaCXX/switch.cpp index fc13630..54240dc 100644 --- a/test/SemaCXX/switch.cpp +++ b/test/SemaCXX/switch.cpp @@ -8,7 +8,8 @@ void test() { } int n = 3; - switch (n && 1) { // expected-warning {{bool}} + switch (n && 1) { // expected-warning {{bool}} \ + // expected-warning {{use of logical && with constant operand}} case 1: break; } |