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

rarut at mail dot ru gcc-bugzilla@gcc.gnu.org
Thu Sep 11 11:35:00 GMT 2008


It's possible to create null references which contradicts the standard:

Assume simple structs:

template<typename T>
struct null_val {
    null_val(T t = T()) : value(t) {}
    T value;
};

template<typename T>
struct null_ref : null_val<T&> {};

Now it's possible to use 'null_ref<int>().value' which is null reference!


-- 
           Summary: GCC Allows null-references in C++
           Product: gcc
           Version: 4.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rarut at mail dot ru


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



More information about the Gcc-bugs mailing list