From: Paolo Carlini <paolo.carlini@oracle.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: Jason Merrill <jason@redhat.com>
Subject: [C++ Patch] PR 50391
Date: Wed, 14 Sep 2011 14:34:00 -0000 [thread overview]
Message-ID: <4E70A470.3060901@oracle.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 173 bytes --]
Hi,
here I'm just avoiding calling build_exception_variant when specs is an
error_mark_node.
Tested x86_64-linux. Ok for mainline?
Thanks,
Paolo.
/////////////////////
[-- Attachment #2: CL_50391 --]
[-- Type: text/plain, Size: 289 bytes --]
/cp
2011-09-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/50391
* pt.c (regenerate_decl_from_template): Don't pass an error_mark_node
to build_exception_variant.
/testsuite
2011-09-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/50391
* g++.dg/cpp0x/noexcept15.C: New.
[-- Attachment #3: patch_50391 --]
[-- Type: text/plain, Size: 1487 bytes --]
Index: testsuite/g++.dg/cpp0x/noexcept15.C
===================================================================
--- testsuite/g++.dg/cpp0x/noexcept15.C (revision 0)
+++ testsuite/g++.dg/cpp0x/noexcept15.C (revision 0)
@@ -0,0 +1,34 @@
+// PR c++/50391
+// { dg-options -std=c++0x }
+
+#include <type_traits>
+
+template<class Tp>
+ struct single
+ {
+ Tp elem; // { dg-error "incomplete type" }
+
+ constexpr single(const Tp& e)
+ : elem(e) { } // { dg-error "invalid field" }
+
+ single(single&& s) // { dg-error "not a member" }
+ noexcept(std::is_nothrow_move_constructible<Tp>::value)
+ : elem(s.elem) { } // { dg-error "invalid field|no member" }
+ };
+
+template<class Tp>
+ constexpr single<typename std::decay<Tp>::type>
+ make_single(Tp&& x)
+ {
+ return single<typename std::decay<Tp>::type>(x);
+ }
+
+class Blob; // { dg-error "forward declaration" }
+
+void
+foo(Blob *b)
+{
+ make_single(*b);
+}
+
+// { dg-prune-output "include" }
Index: cp/pt.c
===================================================================
--- cp/pt.c (revision 178845)
+++ cp/pt.c (working copy)
@@ -17729,7 +17729,7 @@ regenerate_decl_from_template (tree decl, tree tmp
specs = tsubst_exception_specification (TREE_TYPE (code_pattern),
args, tf_error, NULL_TREE,
/*defer_ok*/false);
- if (specs)
+ if (specs && specs != error_mark_node)
TREE_TYPE (decl) = build_exception_variant (TREE_TYPE (decl),
specs);
next reply other threads:[~2011-09-14 12:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-14 14:34 Paolo Carlini [this message]
2011-09-14 15:49 ` Jason Merrill
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=4E70A470.3060901@oracle.com \
--to=paolo.carlini@oracle.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
/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).