Bug 89356 - [9 Regression] sorry, unimplemented: mangling implicit_conv_expr in nodejs8 package since r268321
Summary: [9 Regression] sorry, unimplemented: mangling implicit_conv_expr in nodejs8 p...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P1 normal
Target Milestone: 9.0
Assignee: Marek Polacek
URL:
Keywords: ABI, ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2019-02-14 14:58 UTC by Martin Liška
Modified: 2019-02-17 17:54 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 8.2.0
Known to fail: 9.0
Last reconfirmed: 2019-02-14 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liška 2019-02-14 14:58:36 UTC
Starting from the revision I see:

$ cat sorry.ii
typedef unsigned a;
template <typename> struct h {};
template <int, class b> auto c(b f) -> h<decltype(f(a{0}))>;
typedef char byte;
enum d : byte;
d g(byte);
h<d> e = c<6>(g);

$ g++ sorry.ii -c
sorry.ii: In instantiation of ‘h<decltype (f(((unsigned int)0)))> c(b) [with int <anonymous> = 6; b = d (*)(char)]’:
sorry.ii:3:30: sorry, unimplemented: mangling implicit_conv_expr
    3 | template <int, class b> auto c(b f) -> h<decltype(f(a{0}))>;
      |
Comment 1 Marek Polacek 2019-02-14 15:03:05 UTC
Amusingly, we already handle 
3440   /* Strip a conversion added by convert_nontype_argument.  */
3441   if (TREE_CODE (node) == IMPLICIT_CONV_EXPR)
3442     node = TREE_OPERAND (node, 0);

in write_template_arg.
Comment 2 Marek Polacek 2019-02-15 00:11:40 UTC
A similar testcase

template<typename T> auto fn () -> decltype(unsigned{0} + T(1));
auto e = fn<int>();
Comment 3 Marek Polacek 2019-02-15 02:12:18 UTC
That revision also changes mangling of fn from
decltype (unsigned short{2u}+((int)(3))) fn<int>()
to
decltype ((2u)+((int)(3))) fn<int>()

template<typename T>
auto fn () -> decltype(unsigned{2u} + (T)3) { return 42; }

template auto fn<int>() -> decltype(unsigned{2u} + (int)3);
Comment 4 Marek Polacek 2019-02-15 02:32:41 UTC
reshape_init turns {NON_LVALUE_EXPR <2>} into NON_LVALUE_EXPR <2> and then the mangled name misses "tl<type><expr>E".
Comment 5 Marek Polacek 2019-02-17 17:49:45 UTC
Fixed by r268969, I'm adding new tests.
Comment 6 Marek Polacek 2019-02-17 17:54:26 UTC
Author: mpolacek
Date: Sun Feb 17 17:53:54 2019
New Revision: 268972

URL: https://gcc.gnu.org/viewcvs?rev=268972&root=gcc&view=rev
Log:
	PR c++/89356
	* g++.dg/abi/mangle68.C: New test.
	* g++.dg/cpp0x/decltype69.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/abi/mangle68.C
    trunk/gcc/testsuite/g++.dg/cpp0x/decltype69.C
Modified:
    trunk/gcc/testsuite/ChangeLog
Comment 7 Marek Polacek 2019-02-17 17:54:46 UTC
Done.