https://llvm.org/bugs/show_bug.cgi?id=23381
Bug ID: 23381
Summary: "error: default initialization of an object of const
type 'const Z' requires a user-provided default
constructor" even when no constructor needed.
Product: compiler-rt
Version: 3.4
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: compiler-rt
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
"error: default initialization of an object of const type 'const Z' requires a
user-provided default constructor" even when no constructor needed.
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#253
$ cat > /tmp/x.cc
struct Z {
// no data members
operator int() const { return 0; }
};
void f() {
const Z z1; // ill-formed: no initializer
const Z z2 = { }; // well-formed
}
$ clang++ -c /tmp/x.cc
/tmp/x.cc:7:17: error: default initialization of an object of const type 'const
Z' requires a user-provided default constructor
const Z z1; // ill-formed: no initializer
^
1 error generated.
g++ compiles without error
clang++ --version
clang version 3.4.2 (tags/RELEASE_34/dot2-final)
Target: x86_64-redhat-linux-gnu
Thread model: posix
g++ (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs