Bug 95298 - [11/12/13 Regression] sorry, unimplemented: mangling record_type
Summary: [11/12/13 Regression] sorry, unimplemented: mangling record_type
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 9.3.0
: P2 normal
Target Milestone: 11.5
Assignee: Not yet assigned to anyone
URL:
Keywords: ABI, ice-on-valid-code
: 95299 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-05-24 04:21 UTC by Jonathan Poelen
Modified: 2023-12-22 17:28 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work: 14.0, 6.4.0
Known to fail: 10.3.0, 11.1.0, 7.5.0, 8.5.0, 9.3.0
Last reconfirmed: 2021-05-24 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Poelen 2020-05-24 04:21:00 UTC
Since version 7 to trunk, the following code no longer compiles (https://godbolt.org/z/_j5EUA)

template<class...>
struct list{};

template<int n>
struct _func_select
{
  using f = void;
};

struct func
{
  template<class... seqs>
  using f = typename _func_select<sizeof...(seqs)>::f;
};

template<class... T>
func::f<list<T>...> foo(T&&...)
{}

int main()
{
  foo();
}
Comment 1 Thomas Koenig 2020-05-24 06:04:17 UTC
*** Bug 95299 has been marked as a duplicate of this bug. ***
Comment 2 Patrick Palka 2021-05-24 20:04:32 UTC
Started with r7-2030.
Comment 3 Richard Biener 2021-06-01 08:17:43 UTC
GCC 9.4 is being released, retargeting bugs to GCC 9.5.
Comment 4 Richard Biener 2022-05-27 09:42:48 UTC
GCC 9 branch is being closed
Comment 5 Jakub Jelinek 2022-06-28 10:40:50 UTC
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
Comment 6 janpmoeller 2022-08-28 09:13:06 UTC
This still fails in 12.2 and recent trunk: https://godbolt.org/z/vebz3T6sh

I also encountered
- sorry, unimplemented: mangling reference_type
- sorry, unimplemented: mangling typename_type
on heavily templated code.

In the first case, transforming a function with signature
> template<typename... Types>
> constexpr auto foo(Types&&... args) -> tuple<std::unwrap_ref_decay_t<Types>...>
into
> template<typename... Types>
> constexpr auto foo(Types&&... args) -> decltype(auto)
made the compilation error go away.

In the second case, the similar transformation from
> template<typename... Types>
> constexpr auto bar(Types&&... args) noexcept -> tuple<Types&&...>
to
> template<typename... Types>
> constexpr auto bar(Types&&... args) noexcept -> decltype(auto)
helped.

In a reduced example, I wasn't immediately able to reproduce the issue though. If it helps, I will invest more time to reduce my failing code to a reasonable-size reproduction.
Comment 7 Richard Biener 2023-07-07 10:37:32 UTC
GCC 10 branch is being closed.
Comment 8 GCC Commits 2023-12-22 00:23:45 UTC
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:d26f589e61a178e898d8b247042b487287ffe121

commit r14-6797-gd26f589e61a178e898d8b247042b487287ffe121
Author: Jason Merrill <jason@redhat.com>
Date:   Sat Nov 18 14:35:22 2023 -0500

    c++: sizeof... mangling with alias template [PR95298]
    
    We were getting sizeof... mangling wrong when the argument after
    substitution was a pack expansion that is not a simple T..., such as
    list<T>... in variadic-mangle4.C or (A+1)... in variadic-mangle5.C.  In the
    former case we ICEd; in the latter case we wrongly mangled it as sZ
    <expression>.
    
            PR c++/95298
    
    gcc/cp/ChangeLog:
    
            * mangle.cc (write_expression): Handle v18 sizeof... bug.
            * pt.cc (tsubst_pack_expansion): Keep TREE_VEC for sizeof...
            (tsubst_expr): Don't strip TREE_VEC here.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/cpp0x/variadic-mangle2.C: Add non-member.
            * g++.dg/cpp0x/variadic-mangle4.C: New test.
            * g++.dg/cpp0x/variadic-mangle5.C: New test.
            * g++.dg/cpp0x/variadic-mangle5a.C: New test.