[LLVMbugs] [Bug 10442] New: Class with defaulted default constructor is not trivial
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Jul 22 09:53:21 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10442
Summary: Class with defaulted default constructor is not
trivial
Product: clang
Version: trunk
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: C++0x
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: jonathan.sauer at gmx.de
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
The following program does not compile with clang r:
struct type
{
type() = default; // trivial
};
static_assert(__is_trivial(type), "Not trivial");
This results in:
clang -std=c++0x clang.cpp clang.cpp:5:1: error: static_assert failed "Not
trivial"
static_assert(__is_trivial(Foo), "Not trivial");
^ ~~~~~~~~~~~~~~~~~
1 error generated.
This is contrary to N2210 (where this example is excerpted from), that states
that a defaulted default constructor is trivial if inline:
| Critical to exploiting the benefits of N2172, an inline and explicitly
defaulted definition is trivial if and
| only if the implicit definition would have been trivial. The potential
concern with out-of-class definition
| is "How is the compiler to know if it is trivial?". The existing rule that an
inline definition must occur
| before any use suffices here as well.
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2210.html#trivial>
C.f. FDIS 12.1p5:
| A default constructor is trivial if it is not user-provided and if [nothing
that applies here]
(I don't think a defaulted default constructor should count as "user-provided")
--
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