This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gnu.linkonce too aggressive


> Shouldn't the file name from where the function was taken be included
> in the section name instead of "gnu.linkonce" ?

Thanks for your bug report. This is not a bug in the compiler; it is a
bug in your code: there are no static classes in C++. Instead, you are
declaring qq and ww as static variables.

As a result, you have two definitions for A::A(), thus violating the
one definition rule. As such violation does not require a diagnostic
by the compiler, your program has undefined behaviour.

Instead of static classes, you should use unnamed namespaces.

Regards,
Martin

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]