https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66484

            Bug ID: 66484
           Summary: Exception specification can declare a pointer to
                    incomplete type, which is against C++ standard section
                    15.1
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bluechristlove at 163 dot com
  Target Milestone: ---

In the C++11 standard 15.1.3 Throwing an exception, the standard says that:  If
the
type of the exception object would be an incomplete type or a pointer to an
incomplete type other than (possibly cv-qualified) void the program is
ill-formed.

So if we write the code like this:

[code]

class C;
template <class ...T> void f(T...) throw(T...) {}
void g(C* p) { f(1,p); }

int main()
{   
}

[/code]


This should not be passed, because p is a pointer to incomplete type of C, but
gcc can pass this case.

However, if we compile this case using clang, clang will emit error like this:

main.cpp:2:46: error: pointer to incomplete type 'C' is not allowed in
exception specification
template <class ...T> void f(T...) throw(T...) {}

Reply via email to