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

            Bug ID: 104490
           Summary: Cannot inherit consteval constructor
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

This code
```
struct B {
    bool b = true;
    consteval B(int) {}
};

struct C : B {
    using B::B;
};

static_assert( C{1}.b );
```
looks valid and accepted in Clang and MSVC. But GCC rejects it with the error
```
<source>:7:14: error: 'this' is not a constant expression
    7 |     using B::B;
      |              ^
<source>:7:14: error: '<anonymous>' is not a constant expression
```
Demo: https://gcc.godbolt.org/z/fzajKzobn

Reply via email to