[Bug c++/66672] std::is_same wrong result for captured reference value inside a lambda

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Aug 12 21:46:33 GMT 2021


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-08-12

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
A simplier compile time testcase from PR 99152:

void f() {
  float x, &r = x;
  auto l = [=] () {
    static_assert(std::is_same_v<decltype(x), float>);
    static_assert(std::is_same_v<decltype((x)), const float&>);
    static_assert(std::is_same_v<decltype(r), float&>);

    // fails, decltype((r)) is float&
    static_assert(std::is_same_v<decltype((r)), const float&>);
  };
}


More information about the Gcc-bugs mailing list