public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61808] New: Linking error with explicit template instantiation and default template param
@ 2014-07-15 11:48 gael.guennebaud at gmail dot com
  2021-11-10 10:11 ` [Bug c++/61808] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: gael.guennebaud at gmail dot com @ 2014-07-15 11:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61808
           Summary: Linking error with explicit template instantiation and
                    default template param
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gael.guennebaud at gmail dot com

Created attachment 33124
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33124&action=edit
Tarball of the files to reproduce the issue.

Here is small example which fails to compile with gcc but works well with other
compilers. Compiling the files with:

$ g++ func.cpp main.cpp

produces the following error:

Undefined symbols for architecture x86_64:
  "void foo<2>(Bar::Matrix<2, (2)+((int)((Bar::._1)0))>&)", referenced from:
      _main in ccZW4Wal.o

You can workaround the issue doing either:
1 - In main.cpp, line 3: remove the declaration"enum { fifi = sizeof(int) };" 
2 - In main.cpp, move the above declaration after including func.h
3 - In either func.h or main.cpp, replace one (or both) anonymous enum
declaration with a non-anonymous one.
4 - Move the explicit template declaration from func.cpp to main.cpp.

A real-word use case is described there:
http://stackoverflow.com/questions/24730981/undefined-reference-error-from-gcc-using-a-template-with-a-stdvector-and-an-ei


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/61808] Linking error with explicit template instantiation and default template param
  2014-07-15 11:48 [Bug c++/61808] New: Linking error with explicit template instantiation and default template param gael.guennebaud at gmail dot com
@ 2021-11-10 10:11 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-10 10:11 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-11-10
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, the mangled symbol for GCC, clang and ICC are disagree too.


In GCC case, the anonymous enum name is depdendent on the order of all
anonymous enums while in the clang case, it is always Bar::$_0.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-10 10:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-15 11:48 [Bug c++/61808] New: Linking error with explicit template instantiation and default template param gael.guennebaud at gmail dot com
2021-11-10 10:11 ` [Bug c++/61808] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).