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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=83167,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=86697
           Keywords|                            |accepts-invalid,
                   |                            |rejects-valid

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Complete rejects-valid testcase:

  int main() {
    int x;
    [] {
      [=] {
        using ty1 = decltype((x)); // refers to local variable despite
                                   // innermost by-copy capture-default
        using ty1 = int&;
      };
    };
    [=] {
      [] {
        using ty1 = decltype((x)); // same
        using ty1 = int&;
      };
    };
    [=] {
      [&] {
        using ty1 = decltype((x)); // refers to hypothetical capture proxy
        using ty1 = const int&;
      };
    };
    [&] {
      [=] {
        using ty1 = decltype((x)); // same
        using ty1 = const int&;
      };
    };
    [x] {
       [x] {
         using ty1 = decltype((x)); // refers to actual capture proxy,
                                    // found by HIDDEN_LAMBDA name lookup
         using ty1 = const int&;
       };
    };
    [x] {
       [] {
         using ty1 = decltype((x)); // refers to local variable,
                                    // HIDDEN_LAMBDA name lookup not performed
         using ty1 = int&;
       };
    };
}

Discussion: https://gcc.gnu.org/pipermail/gcc-patches/2023-December/638976.html

Reply via email to