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

John McCall rjmccall at apple.com
Fri Jan 29 10:09:32 PST 2010


On Jan 29, 2010, at 2:21 AM, Enea Zaffanella wrote:

> Hello.
> 
> 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 invocation)
> 
> 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 namespace).

Sounds like a new bug.  Please go ahead and file this, and I'll get to it soon, probably within the next week or so.  Thanks!

John.



More information about the cfe-dev mailing list