public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bluechristlove at 163 dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/66484] New: Exception specification can declare a pointer to incomplete type, which is against C++ standard section 15.1
Date: Wed, 10 Jun 2015 09:59:00 -0000	[thread overview]
Message-ID: <bug-66484-4@http.gcc.gnu.org/bugzilla/> (raw)

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	other threads:[~2015-06-10  9:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-10  9:59 bluechristlove at 163 dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-66484-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).