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

Reply via email to