c++: bogus -Wvexing-parse with trailing-return-type [PR118718]
commit53d1f6cdb5a82e859176e854636400faba0bf0bf
authorMarek Polacek <polacek@redhat.com>
Fri, 31 Jan 2025 19:52:36 +0000 (31 14:52 -0500)
committerMarek Polacek <polacek@redhat.com>
Tue, 4 Feb 2025 14:09:09 +0000 (4 09:09 -0500)
treebd3e81e954bb9186f80dc21671eb10d82e7f795b
parentadf1da77593f8851c6b78d22ebbc1124bbaf1de5
c++: bogus -Wvexing-parse with trailing-return-type [PR118718]

This warning should not warn for

  auto f1 () -> auto;

because that cannot be confused with initializing a variable.

PR c++/118718

gcc/cp/ChangeLog:

* parser.cc (warn_about_ambiguous_parse): Don't warn when a trailing
return type is present.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wvexing-parse10.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/parser.cc
gcc/testsuite/g++.dg/warn/Wvexing-parse10.C [new file with mode: 0644]