[LLVMbugs] [Bug 13123] New: clang C++11 mode allows default-initializing const qualified objects using a user-declared but not user-provided constructor
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Jun 15 17:09:50 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=13123
Bug #: 13123
Summary: clang C++11 mode allows default-initializing const
qualified objects using a user-declared but not
user-provided constructor
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++11
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: seth.cantrell at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
C++11 states "If a program calls for the default initialization of an object of
a const-qualified type T, T shall be a class type with a user-provided default
constructor." [dcl.init] p6
However the following program calls for default initializing a const object
with a default constructor that is merely user-declared:
struct A {
A() = default; // not user-provided constructor
};
int main() {
A const a;
}
I expect an error:
default initialization of an object of const type 'const A' requires a
user-provided default constructor
But the program compiles successfully.
C++98 and C++03 have the same requirement in [dcl.init] p9 but stated
differently "if the object is of const-qualified type, the underlying class
type shall have a user-declared default constructor." The requirement is the
same because in C++98/03 'user-declared' means the same 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