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 57947
Date: Tue, 30 Jul 2013 13:16:00 -0000 [thread overview]
Message-ID: <51F7B39F.9010301@oracle.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 465 bytes --]
Hi,
this issue, error recovery in C++98 mode, is a bit tricky: as far as I
can see, it boils down to the fact that in C++98 mode we don't want to
handle specially std::initializer_list. Otherwise, after the error
message we crash in convert_like_real where we try to handle ck_list, @
line 6056. With the below we emit the exact same diagnostic we emit for
init_list or any other non special name.
Tested x86_64-linux.
Thanks,
Paolo.
////////////////////
[-- Attachment #2: CL_57947 --]
[-- Type: text/plain, Size: 311 bytes --]
/cp
2013-07-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57947
* call.c (add_list_candidates): Only handle specially totype with
TYPE_HAS_LIST_CTOR (totype) set if cxx_dialect != cxx98.
/testsuite
2013-07-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57947
* g++.dg/parse/crash63.C: New.
[-- Attachment #3: patch_57947 --]
[-- Type: text/plain, Size: 1086 bytes --]
Index: cp/call.c
===================================================================
--- cp/call.c (revision 201331)
+++ cp/call.c (working copy)
@@ -3370,7 +3370,8 @@ add_list_candidates (tree fns, tree first_arg,
;
/* If the class has a list ctor, try passing the list as a single
argument first, but only consider list ctors. */
- else if (TYPE_HAS_LIST_CTOR (totype))
+ else if (TYPE_HAS_LIST_CTOR (totype)
+ && cxx_dialect != cxx98)
{
flags |= LOOKUP_LIST_ONLY;
args = make_tree_vector_single (init_list);
Index: testsuite/g++.dg/parse/crash63.C
===================================================================
--- testsuite/g++.dg/parse/crash63.C (revision 0)
+++ testsuite/g++.dg/parse/crash63.C (working copy)
@@ -0,0 +1,10 @@
+// PR c++/57947
+// { dg-options "-std=c++98" }
+
+namespace std
+{
+ template <class E> class initializer_list {};
+ template <int N> struct D { D(initializer_list<int>) {} };
+ D<0> d {1, 2, 3}; // { dg-error "constructor|no matching" }
+ // { dg-warning "initializer list" "" { target *-*-* } 8 }
+}
next reply other threads:[~2013-07-30 12:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-30 13:16 Paolo Carlini [this message]
2013-07-30 13:36 ` Jason Merrill
2013-07-30 14:48 ` Paolo Carlini
2013-07-30 16: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=51F7B39F.9010301@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).