diff options
Diffstat (limited to 'test/SemaCXX')
-rw-r--r-- | test/SemaCXX/ambig-user-defined-conversions.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/conditional-expr.cpp | 4 | ||||
-rw-r--r-- | test/SemaCXX/friend.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/return.cpp | 12 |
4 files changed, 15 insertions, 5 deletions
diff --git a/test/SemaCXX/ambig-user-defined-conversions.cpp b/test/SemaCXX/ambig-user-defined-conversions.cpp index 9811859fcc..fdb399b03a 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/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp index f37ccc8a15..065179b6da 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/friend.cpp b/test/SemaCXX/friend.cpp index 65e0da761c..30abcbbeaa 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 e682fdfb50..6bdbe52727 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}} +} |