Bug 95054 - internal compiler error while overloading class constructor using variadic templates constraint by c++20 concepts
Summary: internal compiler error while overloading class constructor using variadic te...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 10.1.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-11 11:32 UTC by Marcel Breyer
Modified: 2020-06-22 13:56 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel Breyer 2020-05-11 11:32:42 UTC
Overloading a class constructor with variadic templates where both are constraint by c++20 concepts fails to compile with a internal compiler error.

Minimal example (using -std=c++2a):
#include <concepts>

class A {
    template <std::floating_point... T>
    A(T&&... args) { }

    template <std::integral... T>
    A(T&&... args) { }
};

Error message:
<source>: In instantiation of 'template<class ... T>  requires (... && integral<T>) A::A(T&& ...)':

<source>:8:22:   required from here

<source>:8:22: internal compiler error: in push_access_scope, at cp/pt.c:241

    8 |     A(T&&... args) { }

      |                      ^

Full code: https://godbolt.org/z/9byrBN

GCC compiles correctly if you replace the c++20 concepts with "old" SFINAE.
It also compiles WITH concepts on member functions and non-member functions.

clang 10.0.0 and MSVC v19.24 do compile the constructor case correctly.
Comment 1 Marcel Breyer 2020-06-22 13:56:13 UTC
This has been fixed on the current GCC trunk.

https://godbolt.org/z/Lnh9d-