public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/66484] New: Exception specification can declare a pointer to incomplete type, which is against C++ standard section 15.1
@ 2015-06-10  9:59 bluechristlove at 163 dot com
  2015-06-10 15:35 ` [Bug c++/66484] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bluechristlove at 163 dot com @ 2015-06-10  9:59 UTC (permalink / raw)
  To: gcc-bugs

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...) {}


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-05 11:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-10  9:59 [Bug c++/66484] New: Exception specification can declare a pointer to incomplete type, which is against C++ standard section 15.1 bluechristlove at 163 dot com
2015-06-10 15:35 ` [Bug c++/66484] " redi at gcc dot gnu.org
2021-08-04 21:31 ` pinskia at gcc dot gnu.org
2021-08-05 11:21 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).