The following C++ program should not compile:

struct S;
int f(S s);

S *p;
int i = f(*p);

Here an incomplete type is dereferenced as it is passed as a function
argument.

This is forbidden by the C++ standard, clause 3, paragraph 4 (penultimate
bullet). And anyway, how could you compile it to anything sensible without
knowing how big the type is?

Other attempts to dereference incomplete types are diagnosed correctly.

This used to be diagnosed in GCC 4.1.1, but is missing in GCC 4.1.2 onwards.


-- 
           Summary: [4.1/4.2/4.3 Regression] Incomplete types may be
                    derefenced
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: andrew dot stubbs at st dot com


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

Reply via email to