diff options
Diffstat (limited to 'test/SemaCXX/constant-expression-cxx11.cpp')
-rw-r--r-- | test/SemaCXX/constant-expression-cxx11.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/SemaCXX/constant-expression-cxx11.cpp b/test/SemaCXX/constant-expression-cxx11.cpp index 14c0ae3..3a1f6c6 100644 --- a/test/SemaCXX/constant-expression-cxx11.cpp +++ b/test/SemaCXX/constant-expression-cxx11.cpp @@ -1179,7 +1179,7 @@ namespace ExternConstexpr { void f() { extern constexpr int i; // expected-error {{constexpr variable declaration must be a definition}} constexpr int j = 0; - constexpr int k; // expected-error {{default initialization of an object of const type}} expected-note{{add an explicit initializer to initialize 'k'}} + constexpr int k; // expected-error {{default initialization of an object of const type}} } } @@ -1984,3 +1984,13 @@ struct InvalidRedef { int f; // expected-note{{previous definition is here}} constexpr int f(void); // expected-error{{redefinition of 'f'}} expected-warning{{will not be implicitly 'const'}} }; + +namespace PR17938 { + template <typename T> constexpr T const &f(T const &x) { return x; } + + struct X {}; + struct Y : X {}; + struct Z : Y { constexpr Z() {} }; + + static constexpr auto z = f(Z()); +} |