diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/SemaTemplate/crash-unparsed-exception.cpp | 5 | ||||
-rw-r--r-- | clang/test/SemaTemplate/default-arguments-cxx0x.cpp | 27 |
2 files changed, 30 insertions, 2 deletions
diff --git a/clang/test/SemaTemplate/crash-unparsed-exception.cpp b/clang/test/SemaTemplate/crash-unparsed-exception.cpp index 1226b35deb7..3137d3fa197 100644 --- a/clang/test/SemaTemplate/crash-unparsed-exception.cpp +++ b/clang/test/SemaTemplate/crash-unparsed-exception.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify -fcxx-exceptions -fexceptions %s +// expected-no-diagnostics struct A { virtual ~A(); @@ -11,7 +12,7 @@ struct C { ~D() throw(); }; struct E : A { - D<int> d; //expected-error{{exception specification is not available until end of class definition}} + D<int> d; }; - B<int> b; //expected-note{{in instantiation of template class 'B<int>' requested here}} + B<int> b; }; diff --git a/clang/test/SemaTemplate/default-arguments-cxx0x.cpp b/clang/test/SemaTemplate/default-arguments-cxx0x.cpp index d9fa2b4a825..c24ed12a024 100644 --- a/clang/test/SemaTemplate/default-arguments-cxx0x.cpp +++ b/clang/test/SemaTemplate/default-arguments-cxx0x.cpp @@ -87,3 +87,30 @@ namespace PR13986 { A<1> m_target; }; } + +// rdar://problem/34167492 +// Template B is instantiated during checking if defaulted A copy constructor +// is constexpr. For this we check if S<int> copy constructor is constexpr. And +// for this we check S constructor template with default argument that mentions +// template B. In turn, template instantiation triggers checking defaulted +// members exception spec. The problem is that it checks defaulted members not +// for instantiated class only, but all defaulted members so far. In this case +// we try to check exception spec for A default constructor which requires +// initializer for the field _a. But initializers are added after constexpr +// check so we reject the code because cannot find _a initializer. +namespace rdar34167492 { + template <typename T> struct B { using type = bool; }; + + template <typename T> struct S { + S() noexcept; + + template <typename U, typename B<U>::type = true> + S(const S<U>&) noexcept; + }; + + class A { + A() noexcept = default; + A(const A&) noexcept = default; + S<int> _a{}; + }; +} |