summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/constant-expression-cxx11.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-01-09 10:33:23 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-01-09 10:33:23 +0000
commit0fe3f4d731e7d99e5287391af4519ee4a32cba43 (patch)
tree403092aae35eb5ae1c61c28e8c92ac28b6caf107 /clang/test/SemaCXX/constant-expression-cxx11.cpp
parent85d0473650a694606126932eaf021ad7d4f1dc64 (diff)
downloadbcm5719-llvm-0fe3f4d731e7d99e5287391af4519ee4a32cba43.tar.gz
bcm5719-llvm-0fe3f4d731e7d99e5287391af4519ee4a32cba43.zip
Sema: Don't crash when variable is redefined as a constexpr function
We have a diagnostic describing that constexpr changed in C++14 when compiling in C++11 mode. While doing this, it examines the previous declaration and assumes that it is a function. However it is possible, in the context of error recovery, for this to not be the case. llvm-svn: 225518
Diffstat (limited to 'clang/test/SemaCXX/constant-expression-cxx11.cpp')
-rw-r--r--clang/test/SemaCXX/constant-expression-cxx11.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/constant-expression-cxx11.cpp b/clang/test/SemaCXX/constant-expression-cxx11.cpp
index d8f6f0876a8..14c0ae320d7 100644
--- a/clang/test/SemaCXX/constant-expression-cxx11.cpp
+++ b/clang/test/SemaCXX/constant-expression-cxx11.cpp
@@ -1979,3 +1979,8 @@ namespace PR21859 {
constexpr int Fun() { return; } // expected-error {{non-void constexpr function 'Fun' should return a value}}
constexpr int Var = Fun(); // expected-error {{constexpr variable 'Var' must be initialized by a constant expression}}
}
+
+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'}}
+};
OpenPOWER on IntegriCloud