This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/69448] New: Abbreviated function templates with deduced return type still broken
- From: "rs2740 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 23 Jan 2016 22:19:06 +0000
- Subject: [Bug c++/69448] New: Abbreviated function templates with deduced return type still broken
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69448
Bug ID: 69448
Summary: Abbreviated function templates with deduced return
type still broken
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: rs2740 at gmail dot com
Target Milestone: ---
PR64969 fixed cases where an abbreviated function template returns 'auto' or
'decltype(auto)' (or have a trailing return type), but returning `auto*` and
`auto&` etc. is still broken:
long x;
auto& f(auto) { return x; }
auto* g(auto) { return &x; }
auto r = f(1);
auto p = g(1);
prog.cc: In instantiation of 'auto& f(auto:1) [with auto:1 = int]':
prog.cc:4:13: required from here
prog.cc:2:24: error: invalid initialization of non-const reference of type
'int&' from an rvalue of type 'int'
auto& f(auto) { return x; }
^
prog.cc: In instantiation of 'auto* g(auto:2) [with auto:2 = int]':
prog.cc:5:13: required from here
prog.cc:3:25: error: cannot convert 'long int*' to 'int*' in return
auto* g(auto) { return &x; }
^