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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-08-26
            Summary|inherited constructors in   |inherited constructors with
                   |subclass of std::expected   |concept in subclass
                   |can not be overridden       |overrides constructor in
                   |                            |subclass
             Blocks|                            |67491
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |wrong-code
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Slightly reduced:
```
template <class T>
concept true_c = true;

 template <class T>
    struct expected
    {
      T a;
      bool hasvalue;
      constexpr expected(T a1) : a(a1), hasvalue(true){}
      constexpr expected()
      requires true_c<T>
      : a(), hasvalue(true){}
      expected(expected&&) = default;
      T &operator*()
      {
        if (!hasvalue) throw 1;
        return a;
      }
    };

    class my_expected : public expected<int> {
    public:
        using expected<int>::expected;
        my_expected() : expected<int>::expected(42) {}
    };

    int main() {
        my_expected obj;
        return *obj != 42;
    }
```


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues

Reply via email to