Bug 89356

Summary: [9 Regression] sorry, unimplemented: mangling implicit_conv_expr in nodejs8 package since r268321
Product: gcc Reporter: Martin Liška <marxin>
Component: c++Assignee: Marek Polacek <mpolacek>
Status: RESOLVED FIXED    
Severity: normal CC: webrown.cpp
Priority: P1 Keywords: ABI, ice-on-valid-code
Version: unknown   
Target Milestone: 9.0   
Host: Target:
Build: Known to work: 8.2.0
Known to fail: 9.0 Last reconfirmed: 2019-02-14 00:00:00

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.