[Bug c++/37480] GCC Allows null-references in C++

redi at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Dec 11 01:13:00 GMT 2009



------- Comment #4 from redi at gcc dot gnu dot org  2009-12-11 01:12 -------
If you actually instantiate the template you'll get an error:
null_ref<int> n;

<stdin>: In constructor ‘null_val<T>::null_val(T) [with T = int&]’:
<stdin>:8:32: error: invalid value-initialization of reference type
<stdin>: At global scope:
<stdin>:10:15: note: synthesized method ‘null_ref<int>::null_ref()’ first
required here


-- 

redi at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37480



More information about the Gcc-bugs mailing list