This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/86942] New: A trailing-return-type is allowed when the return type is not 'auto' for using declarations
- From: "blitzrakete at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 14 Aug 2018 01:10:51 +0000
- Subject: [Bug c++/86942] New: A trailing-return-type is allowed when the return type is not 'auto' for using declarations
- Auto-submitted: auto-generated
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