This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: gnu.linkonce too aggressive
- To: leob at mailcom dot com
- Subject: Re: gnu.linkonce too aggressive
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Thu, 9 Mar 2000 09:15:18 +0100
- CC: bug-gcc at gnu dot org
- References: <20000308210125.A25704@mailcom.com>
> 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