Re: possible bug in g++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16 February 2012 09:53, Mattia Jona-Lasinio wrote:
> Hmmm, I see the problem. I just find very confusing that the
> compilation of wrong code be compiler dependent or version dependent.
> Wouldn't it be better to mark it as invalid code and to signal it?

That's not generally possible. The compiler cannot tell that you're
going to get a linker error later. When compiling a file it's possible
that the missing definition will be present in some other file and
provided at link time.  That's why the standard says "no diagnostic
required".

> Maybe one could allow the compiler to accept the code with a
> -fpermissive flag. Anyway, thanks a lot!

No, it's better for people to just learn the simple rule that a static
const member that is initialized in-class also needs an out-of-class
definition.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux