[Bug c++/80320] Constructor executed twice for the same static member when using -fno-implicit-templates

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 5 09:43:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80320

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-04-05
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to James Abbatiello from comment #0)
> I don't know exactly what's supposed to happen with -fno-implicit-templates
> and static members.  I initially expected that main.o would not try to
> construct any static members since they were not explicitly instantiated. 
> If that were the case then the static would only be constructed by foo.o and
> things would work correctly.

I think that's what should happen.


> I've tested this on various versions of GCC and it occurs on 4.4.7, 4.9.2,
> 6.3.0 and a copy of 7.0.1 built from trunk so this does not seem like a
> recent regression.

And also 4.3.6


More information about the Gcc-bugs mailing list