Bug 80614 - [7/8 Regression] Bad mangling for noexcept abominable function types
Summary: [7/8 Regression] Bad mangling for noexcept abominable function types
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 7.0
: P2 normal
Target Milestone: 7.2
Assignee: Jason Merrill
URL:
Keywords: ABI
Depends on:
Blocks:
 
Reported: 2017-05-03 19:07 UTC by Alisdair Meredith
Modified: 2017-06-17 02:46 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-05-04 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alisdair Meredith 2017-05-03 19:07:58 UTC
The following simple program complains about duplicate definitions for two different template instantiations:

template <typename T> void fn() {}

int main() {
    fn<void() const>();
    fn<void() const noexcept>();
}


From extensive testing (I'm validating a type traits library) it seems specific to "abominable" function types differing only in the noexcept specification, so is a C++17 specific failure.
Comment 1 Richard Biener 2017-05-04 07:46:38 UTC
Confirmed, needs -std=c++17, works with GCC 6, fails with GCC 7.

> g++-6 t.C -std=c++17
> g++-7 t.C -std=c++17
/tmp/cc9O32gK.s: Assembler messages:
/tmp/cc9O32gK.s:42: Error: symbol `_Z2fnIKFvvEEvv' is already defined
> c++filt _Z2fnIKFvvEEvv
void fn<void () const>()

> g++-6 t.C -std=c++17 -c
> nm t.o
0000000000000000 W _Z2fnIKFvvEEvv
0000000000000000 T main

so that it works with GCC 6 might be because of another bug (the instantiation is missing).
Comment 2 Marek Polacek 2017-05-04 10:51:20 UTC
Bisection points to r241958 but that is nonsense, so I suspect r241944.
Comment 3 Jonathan Wakely 2017-05-04 11:25:09 UTC
(In reply to Marek Polacek from comment #2)
> Bisection points to r241958 but that is nonsense, so I suspect r241944.

Yes that would have been my guess.
Comment 4 Jason Merrill 2017-06-17 02:28:45 UTC
Author: jason
Date: Sat Jun 17 02:28:06 2017
New Revision: 249321

URL: https://gcc.gnu.org/viewcvs?rev=249321&root=gcc&view=rev
Log:
	PR c++/80614 - Wrong mangling for C++17 noexcept type

	* mangle.c (write_type): Put the eh spec back on the function type.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1z/noexcept-type16.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/mangle.c
Comment 5 Jason Merrill 2017-06-17 02:34:03 UTC
Author: jason
Date: Sat Jun 17 02:33:28 2017
New Revision: 249327

URL: https://gcc.gnu.org/viewcvs?rev=249327&root=gcc&view=rev
Log:
	PR c++/80614 - Wrong mangling for C++17 noexcept type

	* mangle.c (write_type): Put the eh spec back on the function type.

Added:
    branches/gcc-7-branch/gcc/testsuite/g++.dg/cpp1z/noexcept-type16.C
Modified:
    branches/gcc-7-branch/gcc/cp/ChangeLog
    branches/gcc-7-branch/gcc/cp/mangle.c
Comment 6 Jason Merrill 2017-06-17 02:46:30 UTC
Fixed.