public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112555] New: NTTP of cv-qualified pointer type fails to mangle in those qualifiers
@ 2023-11-16  1:03 arthur.j.odwyer at gmail dot com
  0 siblings, 0 replies; only message in thread
From: arthur.j.odwyer at gmail dot com @ 2023-11-16  1:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112555
           Summary: NTTP of cv-qualified pointer type fails to mangle in
                    those qualifiers
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arthur.j.odwyer at gmail dot com
  Target Milestone: ---

// https://godbolt.org/z/EGv36xzY6
template<auto V> struct A;

template<class T> void foo();

int i;
int main() {
    foo<A<(int*)nullptr>>();
    foo<A<(const int*)nullptr>>();
    foo<A<(int*)&i>>();
    foo<A<(const int*)&i>>();
}

Clang mangles each call to `foo` differently:
  callq _Z3fooI1AILPi0EEEvv@PLT
  callq _Z3fooI1AILPKi0EEEvv@PLT
  callq _Z3fooI1AIXadL_Z1iEEEEvv@PLT
  callq _Z3fooI1AIXcvPKiadL_Z1iEEEEvv@PLT
GCC mangles the `int*` and `const int*` versions differently for nullptr, but
identically for `&i`. I think this is a GCC bug.
  call _Z3fooI1AILPi0EEEvv
  call _Z3fooI1AILPKi0EEEvv
  call _Z3fooI1AIXadL_Z1iEEEEvv
  call _Z3fooI1AIXadL_Z1iEEEEvv

NVC++ (EDG front-end) matches GCC, not Clang.
MSVC matches Clang, in that the `int*` and `const int*` versions are mangled
distinctly (but using MSVC ABI's mangling conventions of course).

Bug #107222 might be related but seems to be the opposite problem, if anything?

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-16  1:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-16  1:03 [Bug c++/112555] New: NTTP of cv-qualified pointer type fails to mangle in those qualifiers arthur.j.odwyer at gmail dot com

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).