[Bug c++/31300] undetected class name clash
thierry dot galas at med dot ge dot com
gcc-bugzilla@gcc.gnu.org
Mon Mar 26 12:56:00 GMT 2007
------- Comment #8 from thierry dot galas at med dot ge dot com 2007-03-26 13:56 -------
Subject: Re: undetected class name clash
Thanks for the explanation,
I agree that it is hard to detect for a compiler to detect ODL violation,
especially if we want to exclude from ODL local classes outside
anonymous namespace,
but I guess it could be possible at link time, as it is already the case
for C symbols.
There is already patent about this :
http://www.freepatentsonline.com/6149318.html
I understand that this is not an easy task, but if we are not able to do
this we are dealing with a situation poorer than in C
after telling to people, C++ is great, thanks to name mangling, we have
safe linkage,
then we are not able to detect double definitions, that are tricky to
detect especially on large projects where they are likely to occur.
Thanks,
Thierry
bangerth at dealii dot org wrote:
> ------- Comment #7 from bangerth at dealii dot org 2007-03-23 02:13 -------
> (In reply to comment #4)
>
>> I agree , sure it is invalid ,(no mine at the root) but a diagnostic
>> would be nice
>>
>
> It is very hard for a compiler to detect this because it only sees that there
> is a class 'T'. The compiler would need to know whether the declaration
> came from a header file that both .cc files include or was truly meant to
> be a local class.
>
> W.
>
>
>
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31300
More information about the Gcc-bugs
mailing list