[LLVMbugs] [Bug 13052] New: explicitly defaulted constructor is not constexpr
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jun 7 15:55:37 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=13052
Bug #: 13052
Summary: explicitly defaulted constructor is not constexpr
Product: clang
Version: trunk
Platform: PC
OS/Version: other
Status: NEW
Severity: normal
Priority: P
Component: C++11
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: eric at boostpro.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Clang rejects the following code:
template<typename T>
struct wrap
{
// Either delete this line or add constexpr
// to make clang happy.
wrap(wrap &&) = default;
T t;
template<typename U>
explicit constexpr wrap(U &&u)
: t(static_cast<U &&>(u))
{}
};
template<typename T>
struct S
{
S(S &&) = default;
T t;
template<typename U>
explicit constexpr S(U &&u)
: t(static_cast<U &&>(u))
{}
};
constexpr S<wrap<int>> s0(42); // OK
constexpr S<wrap<S<wrap<int>>>> s1(S<wrap<int>>(42)); // FAIL
The comments in the wrap struct shed more light on the issue. According to
Richard Smith on the ISO core reflector, this is a bug in clang.
[dcl.fct.def.default]p2 says:
"If a function is explicitly defaulted on its first declaration, it is
implicitly considered to be constexpr if the implicit declaration would be"
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list