diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
commit | 461a67fa15370a9ec88f8f8a240bf7c123bb2029 (patch) | |
tree | 6942083d7d56bba40ec790a453ca58ad3baf6832 /test/SemaTemplate/default-arguments-cxx0x.cpp | |
parent | 75c3240472ba6ac2669ee72ca67eb72d4e2851fc (diff) |
Notes
Diffstat (limited to 'test/SemaTemplate/default-arguments-cxx0x.cpp')
-rw-r--r-- | test/SemaTemplate/default-arguments-cxx0x.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/SemaTemplate/default-arguments-cxx0x.cpp b/test/SemaTemplate/default-arguments-cxx0x.cpp index d9fa2b4a825ec..c24ed12a0248c 100644 --- a/test/SemaTemplate/default-arguments-cxx0x.cpp +++ b/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{}; + }; +} |