public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96529] New: GCC applies C language linkage to instantiations from abbreviated function templates
@ 2020-08-07 19:35 hstong at ca dot ibm.com
  2021-08-03  4:57 ` [Bug c++/96529] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: hstong at ca dot ibm.com @ 2020-08-07 19:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96529
           Summary: GCC applies C language linkage to instantiations from
                    abbreviated function templates
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hstong at ca dot ibm.com
  Target Milestone: ---

GCC appears to be treating the instantiated specialization of the abbreviated
function template `g` as if it is a function named `g` whose name has C
language linkage.

[dcl.link] does not appear to apply language linkage to the names of
specializations of function templates.

Note: Nor does [dcl.link] apply language linkage to the names of templates (as
opposed to the type that a specialization of the template would have).

Compiler Explorer link: https://godbolt.org/z/s5875s


### SOURCE (<stdin>):
extern "C" {
  void g(auto) {}
  void g(void) { g(42); }
}


### COMPILER INVOCATION:
g++ -std=c++20 -Wall -Wextra -pedantic-errors -xc++ - -c -o /dev/null


### ACTUAL OUTPUT:
/tmp/cc2TjgyX.s: Assembler messages:
/tmp/cc2TjgyX.s:25: Error: symbol `g' is already defined
/tmp/cc2TjgyX.s: Error: .size expression for g does not evaluate to a constant


### EXPECTED OUTPUT:
(clean compile)


### COMPILER VERSION INFO (g++ -v):
Using built-in specs.
COLLECT_GCC=/opt/wandbox/gcc-head/bin/g++
COLLECT_LTO_WRAPPER=/opt/wandbox/gcc-head/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../source/configure --prefix=/opt/wandbox/gcc-head
--enable-languages=c,c++ --disable-multilib --without-ppl --without-cloog-ppl
--enable-checking=release --disable-nls --enable-lto
LDFLAGS=-Wl,-rpath,/opt/wandbox/gcc-head/lib,-rpath,/opt/wandbox/gcc-head/lib64,-rpath,/opt/wandbox/gcc-head/lib32
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20200805 (experimental) (GCC)

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

* [Bug c++/96529] GCC applies C language linkage to instantiations from abbreviated function templates
  2020-08-07 19:35 [Bug c++/96529] New: GCC applies C language linkage to instantiations from abbreviated function templates hstong at ca dot ibm.com
@ 2021-08-03  4:57 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-03  4:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This code is invalid and should be rejected.

*** This bug has been marked as a duplicate of bug 101732 ***

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

end of thread, other threads:[~2021-08-03  4:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-07 19:35 [Bug c++/96529] New: GCC applies C language linkage to instantiations from abbreviated function templates hstong at ca dot ibm.com
2021-08-03  4:57 ` [Bug c++/96529] " 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).