This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/86942] New: A trailing-return-type is allowed when the return type is not 'auto' for using declarations


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

            Bug ID: 86942
           Summary: A trailing-return-type is allowed when the return type
                    is not 'auto' for using declarations
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: blitzrakete at gmail dot com
  Target Milestone: ---

void test() -> void; // fail => ok

using function = void() -> int; // allowed?!?
int f();

int main() {
  function *Boo = f; // not ok; trailing return type is ignored
}

The above code fails to compile on the latest gcc trunk. It is invalid as a
trailing-return-type can only appear if the return type of the function is
'auto'.

No arguments to g++ necessary. Online demo: https://godbolt.org/g/XtSw6T

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]