diff options
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/SemaCXX/constant-expression-cxx11.cpp | 8 | ||||
| -rw-r--r-- | clang/test/SemaCXX/enum-unscoped-nonexistent.cpp | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/constant-expression-cxx11.cpp b/clang/test/SemaCXX/constant-expression-cxx11.cpp index 09a9cb5dd8d..97b0b91b99f 100644 --- a/clang/test/SemaCXX/constant-expression-cxx11.cpp +++ b/clang/test/SemaCXX/constant-expression-cxx11.cpp @@ -1503,3 +1503,11 @@ namespace PR15884 { // expected-note@-3 {{pointer to temporary is not a constant expression}} // expected-note@-4 {{temporary created here}} } + +namespace AfterError { + // FIXME: Suppress the 'no return statements' diagnostic if the body is invalid. + constexpr int error() { // expected-error {{no return statement}} + return foobar; // expected-error {{undeclared identifier}} + } + constexpr int k = error(); // expected-error {{must be initialized by a constant expression}} +} diff --git a/clang/test/SemaCXX/enum-unscoped-nonexistent.cpp b/clang/test/SemaCXX/enum-unscoped-nonexistent.cpp index e9da38f558d..7da9a96d605 100644 --- a/clang/test/SemaCXX/enum-unscoped-nonexistent.cpp +++ b/clang/test/SemaCXX/enum-unscoped-nonexistent.cpp @@ -6,7 +6,7 @@ struct Base { template<typename T> struct S : Base { enum E : int; constexpr int f() const; - constexpr int g() const; // expected-note {{declared here}} + constexpr int g() const; void h(); }; template<> enum S<char>::E : int {}; // expected-note {{enum 'S<char>::E' was explicitly specialized here}} @@ -23,7 +23,7 @@ static_assert(S<int>().f() == 1, ""); // The unqualified-id here names a member of the current instantiation, which // bizarrely might not exist in some instantiations. template<typename T> constexpr int S<T>::g() const { return b; } // expected-error {{enumerator 'b' does not exist in instantiation of 'S<char>'}} -static_assert(S<char>().g() == 1, ""); // expected-note {{here}} expected-error {{not an integral constant expression}} expected-note {{undefined}} +static_assert(S<char>().g() == 1, ""); // expected-note {{here}} expected-error {{not an integral constant expression}} static_assert(S<short>().g() == 2, ""); static_assert(S<long>().g() == 8, ""); |

