Open Quuxplusone opened 11 years ago
Bugzilla Link | PR16773 |
Status | NEW |
Importance | P normal |
Reported by | hstong@ca.ibm.com |
Reported on | 2013-08-02 00:11:04 -0700 |
Last modified on | 2013-10-07 16:30:11 -0700 |
Version | 3.2 |
Hardware | PC other |
CC | dgregor@apple.com, fang@csl.cornell.edu, llvm-bugs@lists.llvm.org, rafael@espindo.la, richard-llvm@metafoo.co.uk |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
None of EDG, g++, and Clang behave as you describe here, but I agree that the wording does imply that this example should be valid, and ICC accepts this code. I'm not sure whether this is a bug in Clang or a bug in the standard's wording.
The following case is along the same lines. This time around GCC, EDG and MSVC
all compile fine but Clang does not.
The root cause could still be a defect in the wording I guess.
struct A { A(...); };
struct B : A { template <typename T> B(volatile T &); };
struct C { operator volatile B &(); };
void foo(A);
int main()
{ C c;
sizeof (foo(c), 0); }
## Expected:
Clean compile.
## Clang output (-std=c++11):
main.cpp:8:15: error: no viable constructor copying parameter of type 'volatile
B'
sizeof (foo(c), 0); }
^
main.cpp:1:8: note: candidate constructor (the implicit copy constructor) not
viable: no known conversion from 'volatile B' to 'const A &' for 1st argument
struct A { A(...); };
^
main.cpp:1:8: note: candidate constructor (the implicit move constructor) not
viable: no known conversion from 'volatile B' to 'A &&' for 1st argument
struct A { A(...); };
^
1 error generated.