https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16106
Jan van Dijk <j.v.dijk at tue dot nl> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |j.v.dijk at tue dot nl
--- Comment #2 from Jan van Dijk <j.v.dijk at tue dot nl> ---
It appears this has been fixed long time ago already: both
g++ (SUSE Linux) 4.8.3 20140627 [gcc-4_8-branch revision 212064]
g++ (GCC) 7.0.0 20160504 (experimental)
print the desired error message:
16106.cpp: In constructor ‘A<T>::A(T&) [with T = int]’:
16106.cpp:8:12: error: invalid initialization of non-const reference of type
‘int&’ from an rvalue of type ‘int’
A<int> a;
^
16106.cpp: In function ‘int main()’:
16106.cpp:8:12: error: invalid initialization of non-const reference of type
‘int&’ from an rvalue of type ‘int’
16106.cpp:3:9: note: in passing argument 1 of ‘A<T>::A(T&) [with T = int]’
A(T& t = T()) : tt(t) {}