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

            Bug ID: 91521
           Summary: [9/10 Regression] expression incorrectly evaluated as
                    function with trailing return type
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aron.ujvary at nng dot com
  Target Milestone: ---

As of g++ 8.3, the following code is well-formed:

struct foo {
        int bar() { return 0; }
        foo* operator->() { return this; }
};

int main()
{
        int pt(foo()->bar());
        return pt;
}

With g++ 9.1.0, 9.2.0, 10.0.0 20190822 (experimental), compilation fails with
"error: ‘parameter’ function with trailing return type not declared with ‘auto’
type specifier"
error message when compiling with c++11 or above, and with
"error: trailing return type only available with ‘-std=c++11’ or
‘-std=gnu++11’"
error message when compiling with c++03.

clang++ 8.0.1 also compiles this snippet just fine.

Reply via email to