diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-14 02:33:50 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-14 02:33:50 +0000 |
commit | eb273b798760ed960edb0a619092da314e21f4ea (patch) | |
tree | 837329cdcce8823d4007196b2e0052570a6a9e79 /test/SemaCXX/cxx0x-defaulted-functions.cpp | |
parent | b74ed087469db042325bad76fdf3ff6ed67dec09 (diff) |
Fix another issue introduced by the proposed wording for core issue 1358: since
the instantiation of a constexpr function temploid is now always constexpr, a
defaulted constexpr function temploid is often ill-formed by the rule in
[dcl.fct.def.default]p2 that an explicitly-defaulted constexpr function must
have a constexpr implicit definition. To avoid making loads of completely
reasonable code ill-formed, do not apply that rule to templates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150453 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/cxx0x-defaulted-functions.cpp')
-rw-r--r-- | test/SemaCXX/cxx0x-defaulted-functions.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/SemaCXX/cxx0x-defaulted-functions.cpp b/test/SemaCXX/cxx0x-defaulted-functions.cpp index d01f63bedb..2e4107c13e 100644 --- a/test/SemaCXX/cxx0x-defaulted-functions.cpp +++ b/test/SemaCXX/cxx0x-defaulted-functions.cpp @@ -28,7 +28,7 @@ bar& bar::operator = (const bar&) = default; bar& bar::operator = (bar&) = default; bar::~bar() = default; -// FIXME: static_assert(__is_trivial(foo), "foo should be trivial"); +static_assert(__is_trivial(foo), "foo should be trivial"); static_assert(!__has_trivial_destructor(bar), "bar's destructor isn't trivial"); static_assert(!__has_trivial_constructor(bar), @@ -43,3 +43,11 @@ void tester() { b = c; } +template<typename T> struct S : T { + constexpr S() = default; + constexpr S(const S&) = default; + constexpr S(S&&) = default; +}; +struct lit { constexpr lit() {} }; +S<lit> s_lit; // ok +S<bar> s_bar; // ok |