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

            Bug ID: 111016
           Summary: Confusing "used in its own initializer" for
                    non-dependent ad-hoc constraint
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ed at catmur dot uk
  Target Milestone: ---

#include <concepts>
struct S { int i; };
static_assert(requires(S s) { requires std::destructible<decltype(s.i)>; });

In file included from <source>:1:
include/c++/14.0.0/concepts:148:13:   required for the satisfaction of
'destructible<decltype (s.i)>'
include/c++/14.0.0/concepts:148:38: error: the value of
'std::__detail::__destructible<decltype (s.i)>' is not usable in a constant
expression
  148 |     concept destructible = __detail::__destructible<_Tp>;
      |                            ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
include/c++/14.0.0/concepts:127:22: note:
'std::__detail::__destructible<decltype (s.i)>' used in its own initializer
  127 |       constexpr bool __destructible = __destructible_impl<_Tp>;
      |                      ^~~~~~~~~~~~~~

Obviously this is IFNDR, but it would be nice to emit a diagnostic which gives
some better clue to what is going on (e.g. "warning: constraint is
non-dependent"). Unfortunately both clang and MSVC accept with no diagnostic,
making this look like a gcc bug.

Reply via email to