summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/implicit-exception-spec.cpp
diff options
context:
space:
mode:
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