[cfe-dev] clang crashes on (non-template) friend declaration.

Enea Zaffanella zaffanella at cs.unipr.it
Fri Jan 29 02:21:10 PST 2010


The attached test shows a crash when parsing a friend declaration.
I have searched in existing bug reports concerning friendship, but I 
have only found bugs related to templates (apologies if I happened to 
search in the wrong places).

Stack dump:
0.	Program arguments: /home/zaffanella/git-stuff/llvm/Debug/bin/clang 
-cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -disable-free 
-main-file-name bug.cc -mrelocation-model static -mdisable-fp-elim 
-munwind-tables -target-cpu x86-64 -resource-dir 
/home/zaffanella/git-stuff/llvm/Debug/lib/clang/1.1 -fmessage-length 80 
-fexceptions -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics 
-x c++ bug.cc
1.	bug.cc:7:17: current parser token ';'
2.	bug.cc:6:1: parsing struct/union/class body 'N::C'
clang: error: compiler command failed due to signal 11 (use -v to see 

NOTE: this was tested with r93873.

Having tried a few variations, I suppose that the crash is there if:
   - the class definition has a qualified name (i.e., it was forward 
declared in a namespace decl and it is now defined out of that namespace);
   - the friend declaration introduces a *new* name which should be 
added to the declaration context containing the class (i.e., the 

Enea Zaffanella.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug.cc
Type: text/x-c++src
Size: 107 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100129/035ba4f1/attachment.cc>

More information about the cfe-dev mailing list