summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/exception-spec.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-09-30 00:48:50 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-09-30 00:48:50 +0000
commita91de375f2785352fa26407ef85a4347bccea98e (patch)
tree8d42f3d0cd42c6387dc7fc3fa077af01b61a994e /clang/test/SemaCXX/exception-spec.cpp
parentb189b5c5359e2bd2143bacde3d73459fd84186bf (diff)
downloadbcm5719-llvm-a91de375f2785352fa26407ef85a4347bccea98e.tar.gz
bcm5719-llvm-a91de375f2785352fa26407ef85a4347bccea98e.zip
Promote a warning on ill-formed code (redeclaration missing an exception
specification) to an error. No compiler other than Clang seems to allow this, and it doesn't seem like a useful thing to accept as an extension in general. The current behavior was added for PR5957, where the problem was specifically related to mismatches of the exception specification on the implicitly-declared global operator new and delete. To retain that workaround, we downgrade the error to an ExtWarn when the declaration is of a replaceable global allocation function. Now that this is an error, stop trying (and failing) to recover from a missing computed noexcept specification. That recovery didn't work, and led to crashes in code like the added testcase. llvm-svn: 248867
Diffstat (limited to 'clang/test/SemaCXX/exception-spec.cpp')
-rw-r--r--clang/test/SemaCXX/exception-spec.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/exception-spec.cpp b/clang/test/SemaCXX/exception-spec.cpp
new file mode 100644
index 00000000000..f301a63503d
--- /dev/null
+++ b/clang/test/SemaCXX/exception-spec.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -fcxx-exceptions -std=c++11 %s
+
+namespace MissingOnTemplate {
+ template<typename T> void foo(T) noexcept(true); // expected-note {{previous}}
+ template<typename T> void foo(T); // expected-error {{missing exception specification 'noexcept(true)'}}
+ void test() { foo(0); }
+}
OpenPOWER on IntegriCloud