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

            Bug ID: 110513
           Summary: Invalid use of incomplete type std::bool_constant
                    inside requires expression
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

The following program


#include <type_traits>

struct B {
    bool b = true;
};

// ok everywhere
static_assert( std::bool_constant<B{}.b>{}() );

// error in GCC
static_assert( requires() { std::bool_constant<B{}.b>{}(); } );


is accepted in Clang and MSVC, but GCC complains


<source>:11:56: error: invalid use of incomplete type
'std::bool_constant<B{}.b>'
   11 | static_assert( requires() { std::bool_constant<B{}.b>{}(); } );
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
In file included from <source>:1:
/opt/compiler-explorer/gcc-13.1.0/include/c++/13.1.0/type_traits:62:12: note:
declaration of 'std::bool_constant<B{}.b>'
   62 |     struct integral_constant
      |            ^~~~~~~~~~~~~~~~~


Online demo: https://gcc.godbolt.org/z/csKanbM88

Reply via email to