summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/implicit-exception-spec.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2012-08-15 20:02:54 +0000
committerdim <dim@FreeBSD.org>2012-08-15 20:02:54 +0000
commit554bcb69c2d785a011a30e7db87a36a87fe7db10 (patch)
tree9abb1a658a297776086f4e0dfa6ca533de02104e /test/SemaCXX/implicit-exception-spec.cpp
parentbb67ca86b31f67faee50bd10c3b036d65751745a (diff)
downloadFreeBSD-src-554bcb69c2d785a011a30e7db87a36a87fe7db10.zip
FreeBSD-src-554bcb69c2d785a011a30e7db87a36a87fe7db10.tar.gz
Vendor import of clang trunk r161861:
http://llvm.org/svn/llvm-project/cfe/trunk@161861
Diffstat (limited to 'test/SemaCXX/implicit-exception-spec.cpp')
-rw-r--r--test/SemaCXX/implicit-exception-spec.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/test/SemaCXX/implicit-exception-spec.cpp b/test/SemaCXX/implicit-exception-spec.cpp
index 25316f8..b29cff5 100644
--- a/test/SemaCXX/implicit-exception-spec.cpp
+++ b/test/SemaCXX/implicit-exception-spec.cpp
@@ -17,7 +17,7 @@ namespace InClassInitializers {
// is false.
bool ThrowSomething() noexcept(false);
struct ConstExpr {
- bool b = noexcept(ConstExpr()) && ThrowSomething(); // expected-error {{exception specification is not available until end of class definition}}
+ bool b = noexcept(ConstExpr()) && ThrowSomething(); // expected-error {{cannot be used by non-static data member initializer}}
};
// We can use it now.
bool w = noexcept(ConstExpr());
@@ -25,18 +25,27 @@ namespace InClassInitializers {
// Much more obviously broken: we can't parse the initializer without already
// knowing whether it produces a noexcept expression.
struct TemplateArg {
- int n = ExceptionIf<noexcept(TemplateArg())>::f(); // expected-error {{exception specification is not available until end of class definition}}
+ int n = ExceptionIf<noexcept(TemplateArg())>::f(); // expected-error {{cannot be used by non-static data member initializer}}
};
bool x = noexcept(TemplateArg());
// And within a nested class.
+ // FIXME: The diagnostic location is terrible here.
struct Nested {
struct Inner {
- int n = ExceptionIf<noexcept(Nested())>::f(); // expected-error {{exception specification is not available until end of class definition}}
- } inner;
+ int n = ExceptionIf<noexcept(Nested())>::f();
+ } inner; // expected-error {{cannot be used by non-static data member initializer}}
};
bool y = noexcept(Nested());
bool z = noexcept(Nested::Inner());
+
+ struct Nested2 {
+ struct Inner;
+ int n = Inner().n; // expected-error {{cannot be used by non-static data member initializer}}
+ struct Inner {
+ int n = ExceptionIf<noexcept(Nested())>::f();
+ } inner;
+ };
}
namespace ExceptionSpecification {
OpenPOWER on IntegriCloud