[cfe-dev] interesting c++ puzzle

reed kotler rkotler at mips.com
Wed Jan 16 13:04:44 PST 2013


I'm far from a c++ language lawyer. I decided, in my spare time,  to 
work on some involved language related clang bugs to reverse that situation.

I picked this one http://llvm.org/bugs/show_bug.cgi?id=8539 .

I've been trying to understand the rules surrounding this bug, which 
interestingly enough used to cause g++ to crash and still causes clang 
as well as the sun compiler to crash.

Here is an interesting pair of test cases I came up with.

5.cpp gets the same result on at least 4 compilers. It compiles 
correctly, and prints B(1)

6.cpp does not compile on clang++ or g++.

This seems illogical to me. It does not call the copy constructor in 
5.cpp but in 6.cpp it tails
to compile because it can't find a valid copy constructor.

I have a number of other related test cases. I want to make a fix that 
really fixes this general class of issues and not just make the crash go 
away for that one test case.

On other compilers, both 5.cpp and 6.cpp get the same result.

Tia.

Reed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130116/34d02994/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 5.cpp
Type: text/x-c++src
Size: 242 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130116/34d02994/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 6.cpp
Type: text/x-c++src
Size: 195 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130116/34d02994/attachment-0001.cpp>


More information about the cfe-dev mailing list