summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaCXX')
-rw-r--r--clang/test/SemaCXX/exceptions-seh.cpp7
-rw-r--r--clang/test/SemaCXX/warn-bool-conversion.cpp24
2 files changed, 25 insertions, 6 deletions
diff --git a/clang/test/SemaCXX/exceptions-seh.cpp b/clang/test/SemaCXX/exceptions-seh.cpp
index 1d8cc4917e9..02bb786160d 100644
--- a/clang/test/SemaCXX/exceptions-seh.cpp
+++ b/clang/test/SemaCXX/exceptions-seh.cpp
@@ -39,14 +39,13 @@ void instantiate_bad_scope_tmpl() {
}
#if __cplusplus < 201103L
-// FIXME: Diagnose this case. For now we produce undef in codegen.
template <typename T, T FN()>
T func_template() {
- return FN();
+ return FN(); // expected-error 2{{builtin functions must be directly called}}
}
void inject_builtins() {
- func_template<void *, __exception_info>();
- func_template<unsigned long, __exception_code>();
+ func_template<void *, __exception_info>(); // expected-note {{instantiation of}}
+ func_template<unsigned long, __exception_code>(); // expected-note {{instantiation of}}
}
#endif
diff --git a/clang/test/SemaCXX/warn-bool-conversion.cpp b/clang/test/SemaCXX/warn-bool-conversion.cpp
index ab563aa6898..6eca171f254 100644
--- a/clang/test/SemaCXX/warn-bool-conversion.cpp
+++ b/clang/test/SemaCXX/warn-bool-conversion.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify=expected,expected-cxx11 %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -fsyntax-only -verify=expected,expected-cxx11 -std=c++11 %s
namespace BooleanFalse {
int* j = false;
@@ -192,3 +192,23 @@ namespace macros {
// expected-warning@-1{{address of 'x' will always evaluate to 'true'}}
}
}
+
+namespace Template {
+ // FIXME: These cases should not warn.
+ template<int *p> void f() { if (p) {} } // expected-warning 2{{will always evaluate to 'true'}} expected-cxx11-warning {{implicit conversion of nullptr}}
+ template<int (*p)[3]> void g() { if (p) {} } // expected-warning 2{{will always evaluate to 'true'}} expected-cxx11-warning {{implicit conversion of nullptr}}
+ template<int (*p)()> void h() { if (p) {} }
+
+ int a, b[3], c[3][3], d();
+ template void f<&a>(); // expected-note {{instantiation of}}
+ template void f<b>(); // expected-note {{instantiation of}}
+#if __cplusplus >= 201103L
+ template void f<(int*)nullptr>(); // expected-note {{instantiation of}}
+#endif
+ template void g<&b>(); // expected-note {{instantiation of}}
+ template void g<c>(); // expected-note {{instantiation of}}
+#if __cplusplus >= 201103L
+ template void g<(int(*)[3])nullptr>(); // expected-note {{instantiation of}}
+#endif
+ template void h<d>();
+}
OpenPOWER on IntegriCloud