[Bug c++/99909] New: The value of 'std::is_integral_v<auto>' is not usable in a constant expression

hewillk at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Apr 4 18:30:15 GMT 2021


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

            Bug ID: 99909
           Summary: The value of 'std::is_integral_v<auto>' is not usable
                    in a constant expression
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/jWr39rrsT

#include <concepts>

template <std::integral auto> 
struct S {};

template <template <std::integral auto> class>
constexpr auto f() {}

int main() {
  f<S>();
}

gcc rejects this code with:

In file included from <source>:1:
/opt/compiler-explorer/gcc-trunk-20210404/include/c++/11.0.1/concepts:102:13:  
required for the satisfaction of 'integral<auto [requires
std::integral<<placeholder>, >]>' [with auto [requires
std::integral<<placeholder>, >] = auto [requires std::integral<<placeholder>,
>]]
/opt/compiler-explorer/gcc-trunk-20210404/include/c++/11.0.1/concepts:102:24:
error: the value of 'std::is_integral_v<auto [requires
std::integral<<placeholder>, >]>' is not usable in a constant expression
  102 |     concept integral = is_integral_v<_Tp>;
      |                        ^~~~~~~~~~~~~~~~~~
In file included from
/opt/compiler-explorer/gcc-trunk-20210404/include/c++/11.0.1/concepts:44,
                 from <source>:1:
/opt/compiler-explorer/gcc-trunk-20210404/include/c++/11.0.1/type_traits: In
function 'int main()':
/opt/compiler-explorer/gcc-trunk-20210404/include/c++/11.0.1/type_traits:3026:25:
note: 'std::is_integral_v<auto [requires std::integral<<placeholder>, >]>' used
in its own initializer
 3026 |   inline constexpr bool is_integral_v = is_integral<_Tp>::value;
      |                         ^~~~~~~~~~~~~


More information about the Gcc-bugs mailing list