[Bug c++/95054] New: internal compiler error while overloading class constructor using variadic templates constraint by c++20 concepts

breyer.marcel at web dot de gcc-bugzilla@gcc.gnu.org
Mon May 11 11:32:42 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95054

            Bug ID: 95054
           Summary: internal compiler error while overloading class
                    constructor using variadic templates constraint by
                    c++20 concepts
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: breyer.marcel at web dot de
  Target Milestone: ---

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.


More information about the Gcc-bugs mailing list