diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-19 00:08:28 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-19 00:08:28 +0000 |
commit | 13bffc532bafd45d4a77867993c1afb83c7661be (patch) | |
tree | 147f1e50c494e1a5616b3cf157381308109aeb19 /test/SemaTemplate/instantiate-exception-spec-cxx11.cpp | |
parent | 103f41d0e72a9e52a07e19cbde58c3afc8735098 (diff) |
PR 12586: Fix assert while running libc++ testsuite: deal with exception
specifications on member function templates of class templates and other such
nested beasties. Store the function template from which we are to instantiate
an exception specification rather than trying to deduce it. Plus some
additional test cases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155076 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/instantiate-exception-spec-cxx11.cpp')
-rw-r--r-- | test/SemaTemplate/instantiate-exception-spec-cxx11.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp b/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp index d29c8862b9..8a6f9efa68 100644 --- a/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp +++ b/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -ftemplate-depth 16 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -ftemplate-depth 16 -fcxx-exceptions -fexceptions %s // DR1330: an exception specification for a function template is only // instantiated when it is needed. @@ -31,7 +31,7 @@ decltype(S<0>::recurse()) *pVoid1 = 0; // ok, exception spec not needed decltype(&S<0>::recurse) pFn = 0; // ok, exception spec not needed template<> struct S<10> {}; -void (*pFn2)() noexcept = &S<0>::recurse; // expected-note {{instantiation of exception spec}} +void (*pFn2)() noexcept = &S<0>::recurse; // expected-note {{instantiation of exception spec}} expected-error {{not superset}} template<typename T> T go(T a) noexcept(noexcept(go(a))); // \ @@ -118,3 +118,16 @@ namespace pr9485 { f2(0); // expected-error {{ambiguous}} } } + +struct Exc1 { char c[4]; }; +struct Exc2 { double x, y, z; }; +struct Base { + virtual void f() noexcept; // expected-note {{overridden}} +}; +template<typename T> struct Derived : Base { + void f() noexcept (sizeof(T) == 4); // expected-error {{is more lax}} + void g() noexcept (T::error); +}; + +Derived<Exc1> d1; // ok +Derived<Exc2> d2; // expected-note {{in instantiation of}} |