[Bug c++/67343] New: C++ mangler does not follow ABI for local names in expressions
ian at airs dot com
gcc-bugzilla@gcc.gnu.org
Mon Aug 24 22:23:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67343
Bug ID: 67343
Summary: C++ mangler does not follow ABI for local names in
expressions
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ian at airs dot com
CC: jason at gcc dot gnu.org
Target Milestone: ---
If I compile this C++ file with current mainline
template<bool B> class H {
public:
enum T { V = B };
};
template <typename T> class C {
public:
enum { B1 = true, B2 = false };
};
template<typename T>
void f(typename H<C<T>::B1 && !C<T>::B2>::T) {}
void g() {
f<int>(H<true>::V);
}
I get this symbol:
_Z1fIiEvN1HIXaasr1CIT_E2B1ntsrS3_2B2EE1TE
I believe that this symbol is not mangled according to the current C++ mangling
ABI. The relevant part is the expression Xaasr1CIT_E2B1ntsrS3_2B2E,
specifically the local name sr1CIT_E2B1. The mangling ABI says
<unresolved-name> ::= [gs] <base-unresolved-name>
::= sr <unresolved-type> <base-unresolved-name>
::= srN <unresolved-type> <unresolved-qualifier-level>+ E
<base-unresolved-name>
::= [gs] sr <unresolved-qualifier-level>+ E
<base-unresolved-name>
<unresolved-type> ::= <template-param>
::= <decltype>
::= <substitution>
The string after "sr" is 1CIT_E2B1. The 1C is not a template-param, a
decltype, or a substitution. Therefore we must be using the fourth expansion
of <unresolved-name>, where we expect to see a series of
<unresolved-qualifier-level> entries, followed by an E, followed by a
<base-unresolved-name>. But in fact what we see here is <type>
<unqualified-name>. This is what the code in cp/mangle.c outputs:
write_string ("sr");
write_type (scope);
write_member_name (member);
Either the mangling ABI or GCC itself is wrong.
More information about the Gcc-bugs
mailing list