summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/return.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2010-07-14 06:36:18 +0000
committerChandler Carruth <chandlerc@gmail.com>2010-07-14 06:36:18 +0000
commitcb3b5a483fde37bce8086fc074f822962c58d952 (patch)
tree0448841834bd2ac0791acd144ffae63b05c5f384 /clang/test/SemaCXX/return.cpp
parentbad47f62f6e104687943389d2b151f1a1a2db35b (diff)
downloadbcm5719-llvm-cb3b5a483fde37bce8086fc074f822962c58d952.tar.gz
bcm5719-llvm-cb3b5a483fde37bce8086fc074f822962c58d952.zip
Wire up '-Wignored-qualifiers' to the warning on 'const' in 'const int f()'.
This flag and warning match GCC semantics. Also, move it to -Wextra as this is a largely cosmetic issue and doesn't seem to mask problems. Subsequent fixes to the tests which no longer by default emit the warning. Added explicit test cases for both C and C++ behavior with the warning turned on. llvm-svn: 108325
Diffstat (limited to 'clang/test/SemaCXX/return.cpp')
-rw-r--r--clang/test/SemaCXX/return.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/return.cpp b/clang/test/SemaCXX/return.cpp
index e682fdfb500..6bdbe52727b 100644
--- a/clang/test/SemaCXX/return.cpp
+++ b/clang/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}}
+}
OpenPOWER on IntegriCloud