From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64710 invoked by alias); 24 Aug 2015 22:23:54 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 64617 invoked by uid 48); 24 Aug 2015 22:23:45 -0000 From: "ian at airs dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/67343] New: C++ mangler does not follow ABI for local names in expressions Date: Mon, 24 Aug 2015 22:23:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ian at airs dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-08/txt/msg01695.txt.bz2 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 class H { public: enum T { V = B }; }; template class C { public: enum { B1 = true, B2 = false }; }; template void f(typename H::B1 && !C::B2>::T) {} void g() { f(H::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 ::= [gs] ::= sr ::= srN + E ::= [gs] sr + E ::= ::= ::= 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 , where we expect to see a series of entries, followed by an E, followed by a . But in fact what we see here is . 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.