[Bug c++/59284] New: missing diagnostic on incomplete type at the point of template definition

vanyacpp at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Nov 25 11:17:00 GMT 2013


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

            Bug ID: 59284
           Summary: missing diagnostic on incomplete type at the point of
                    template definition
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vanyacpp at gmail dot com

According to [temp.res]p8 this code is invalid, but gcc don't show error on it:

struct x;

template <typename T>
void f()
{
    x x;
}

"If a type used in a non-dependent name is incomplete at the point at which a
template is defined but is complete at the point at which an instantiation is
done, and if the completeness of that type affects whether or not the program
is well-formed or affects the semantics of the program, the program is
ill-formed; no diagnostic is required."

clang gives error:

19.cpp:7:7: error: variable has incomplete type 'x'
    x x;
      ^
19.cpp:2:8: note: forward declaration of 'x'
struct x;
       ^
1 error generated.



More information about the Gcc-bugs mailing list