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

            Bug ID: 84374
           Summary: placeholder decltype(auto) accepted when it's not the
                    placeholder alone in trailing-return-type
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: smw at gcc dot gnu.org
  Target Milestone: ---

[dcl.spec.auto]/7 says "If the placeholder is the decltype(auto)
type-specifier, the declared type of the variable or return type of the
function shall be the placeholder alone."

Yet the following code issues no diagnostic in any version of GCC (and does so
with other toolchains like ICC, clang, and MSVC).

    auto l = [](auto* r)->decltype(auto)* { return r; };
    auto m = [](auto* r)->decltype(auto)& { return *r; };

Reply via email to