[Bug c++/69549] Named Address Spaces does not compile in C++
thiago at kde dot org
gcc-bugzilla@gcc.gnu.org
Tue Mar 23 01:36:18 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69549
--- Comment #7 from Thiago Macieira <thiago at kde dot org> ---
(In reply to Andrew Pinski from comment #6)
> The above is not the reason why namespaces are not handled in GCC's C++
> front-end. The reason why they are not handled in C++ is because you need
> to handle them in overloads and templates correctly. Does clang handle
> those correctly or does it ignore that issue?
It handles them:
$ clang -O2 -S -o - -include stdint.h -xc++ - <<<'template <typename T> void
f(T); void f() { auto tib = (void * __seg_fs*)(0); f(tib); }' | c++filt
.text
.file "-"
.globl f() # -- Begin function f()
.p2align 4, 0x90
.type f(),@function
f(): # @f()
.cfi_startproc
# %bb.0:
xorl %edi, %edi
jmp void f<void* AS257*>(void* AS257*) # TAILCALL
The mangled symbol was _Z1fIPU5AS257PvEvT_. That "AS257" is encoded as U5AS257,
which is an extended qualifier.
<https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.qualified-type>:
5.1.5.1 Qualified types
<qualified-type> ::= <qualifiers> <type>
<qualifiers> ::= <extended-qualifier>* <CV-qualifiers>
<extended-qualifier> ::= U <source-name> [<template-args>] # vendor extended
type qualifier
<CV-qualifiers> ::= [r] [V] [K] # restrict (C99), volatile, const
<ref-qualifier> ::= R # & ref-qualifier
<ref-qualifier> ::= O # && ref-qualifier
More information about the Gcc-bugs
mailing list