[cfe-dev] Injected class name

Douglas Gregor dgregor at apple.com
Mon Jun 14 09:44:29 PDT 2010


On Jun 14, 2010, at 7:27 AM, Renato Golin wrote:

> Hi,
>  
> Why does clang refuse this case?
>  
> Looks like it still thinks that *p is opaque at the object definition, when it’s not.
>  
> class Class {
> public:
>         Class *p;
>   int i;
>         Class(int a) : p(0), i(a) {}
> };
> const class Class &object = 0;
>  
> /*
> $ clang -c injected.cpp
> injected.cpp:7:29: error: cannot compile this global variable that binds reference to a non-lvalue yet
> const class Class &object = 0;
>                             ^
> 1 error generated.
> */
>  
> As far as I understand, chapter 9 (paragraph 2) of the (C++03) standard allows you to do that. Other compilers, such as G++, understand it without problems.

This is a known bug. See

	http://llvm.org/bugs/show_bug.cgi?id=7326

	- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100614/03264589/attachment.html>


More information about the cfe-dev mailing list