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

            Bug ID: 80851
           Summary: All versions that support C++11 are confused by
                    combination of inherited constructors with member
                    initializer that captures this
           Product: gcc
           Version: 7.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: devgs at ukr dot net
  Target Milestone: ---

Tested with:
    4.8.1 - 7.1

Test case:

struct BaseFooWrapper
{
    BaseFooWrapper(int qux)
    { }
};

struct Foo
{
    Foo(BaseFooWrapper & foo)
        : foo(foo)
    { }

    BaseFooWrapper & foo;
};

struct SomeFooWrapper : public BaseFooWrapper
{
    using BaseFooWrapper::BaseFooWrapper;


    Foo foo{*this};
};

int main()
{
    SomeFooWrapper wrapped_foo(1);
    return 0;
}



Error output:


#1 with x86-64 gcc 7.1
<source>: In function 'int main()':
<source>:29:33: error: use of deleted function
'SomeFooWrapper::SomeFooWrapper(int) [inherited from BaseFooWrapper]'
     SomeFooWrapper wrapped_foo(1);
                                 ^
<source>:20:27: note: 'SomeFooWrapper::SomeFooWrapper(int) [inherited from
BaseFooWrapper]' is implicitly deleted because the default definition would be
ill-formed:
     using BaseFooWrapper::BaseFooWrapper;
                           ^~~~~~~~~~~~~~
<source>:20:27: error: no matching function for call to 'Foo::Foo()'
<source>:11:5: note: candidate: Foo::Foo(BaseFooWrapper&)
     Foo(BaseFooWrapper & foo)
     ^~~
<source>:11:5: note:   candidate expects 1 argument, 0 provided
<source>:9:8: note: candidate: constexpr Foo::Foo(const Foo&)
 struct Foo
        ^~~
<source>:9:8: note:   candidate expects 1 argument, 0 provided
<source>:9:8: note: candidate: constexpr Foo::Foo(Foo&&)
<source>:9:8: note:   candidate expects 1 argument, 0 provided

Reply via email to