aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-07-15 17:07:12 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-07-15 17:07:12 +0000
commit4e58654b47e89efbb1a8ca032c08fd354c3b0b61 (patch)
tree5e946d69177464379cb1a38ac18206180d763639 /test/SemaCXX
parent4ba675006b5a8edfc48b6a9bd3dcf54a70cc08f2 (diff)
downloadsrc-4e58654b47e89efbb1a8ca032c08fd354c3b0b61.tar.gz
src-4e58654b47e89efbb1a8ca032c08fd354c3b0b61.zip
Update clang to r108428.
Notes
Notes: svn path=/vendor/clang/dist/; revision=210128
Diffstat (limited to 'test/SemaCXX')
-rw-r--r--test/SemaCXX/ambig-user-defined-conversions.cpp2
-rw-r--r--test/SemaCXX/bool.cpp4
-rw-r--r--test/SemaCXX/conditional-expr.cpp4
-rw-r--r--test/SemaCXX/cv-unqual-rvalues.cpp24
-rw-r--r--test/SemaCXX/friend.cpp2
-rw-r--r--test/SemaCXX/return.cpp12
-rw-r--r--test/SemaCXX/switch.cpp3
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 9811859fccce..fdb399b03a21 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 44e17ce62b79..726fa6cb60fc 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 f37ccc8a15da..065179b6da59 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 000000000000..ed76ced38c76
--- /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 65e0da761cfd..30abcbbeaa52 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 e682fdfb5009..6bdbe52727b2 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 fc13630bbf12..54240dcc305f 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;
}