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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-06-05
      Known to work|                            |12.3.0
                 CC|                            |ppalka at gcc dot gnu.org
           Keywords|                            |rejects-valid
      Known to fail|                            |13.1.0, 14.0
     Ever confirmed|0                           |1
            Summary|using an aggregate with a   |[13/14 Regression] using an
                   |member variable with a user |aggregate with a member
                   |defined copy constructor in |variable with a user
                   |a class NTTP causes capture |defined copy constructor in
                   |and use of the `this`       |a class NTTP causes capture
                   |pointer in a generic lambda |and use of the `this`
                   |to produce the following    |pointer in a generic lambda
                   |error "-copy constructor-   |to produce the following
                   |used before its definition" |error "-copy ctor- used
                   |                            |before its definition"
   Target Milestone|---                         |13.2
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot 
gnu.org
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=104577
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed, thanks very much for the detailed analysis and reproducer.  Started
with r13-1045-gcb7fd1ea85feea.

Here's another version of the testcase (with a commented out workaround) that
uses a non-capturing generic lambda and a non-member function:

struct Foo {
    constexpr Foo() = default;
    constexpr Foo(Foo const&) {}
};

struct Bar {
    Foo _;

    // Workaround: force Bar's copy ctor to be synthesized early
    // static Bar force_synthesize_copy_ctor(Bar& b) { return b; };
};

template<Bar v>
struct Doppelganger { };

template<Bar v>
void disguise() {
    [](auto){ Doppelganger<v> d; }(0);
};

void execute() {
    disguise<Bar{}>();
}

Reply via email to