From: Jason Merrill <jason@redhat.com>
To: gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: C++ PATCH for c++/49298 (C++0x regression with pointer to member)
Date: Mon, 06 Jun 2011 19:43:00 -0000 [thread overview]
Message-ID: <4DED2DDF.90102@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 155 bytes --]
potential_constant_expression_1 didn't know how to deal with a
pointer-to-member expression in a template.
Tested x86_64-pc-linux-gnu, applied to trunk.
[-- Attachment #2: 49298.patch --]
[-- Type: text/x-patch, Size: 1058 bytes --]
commit a07ee89ff40f73dcb1fc11fb66931ee79bf8a2d9
Author: Jason Merrill <jason@redhat.com>
Date: Mon Jun 6 12:05:39 2011 -0400
PR c++/49298
* semantics.c (potential_constant_expression_1): Handle FIELD_DECL.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 5626a86..f005f2f 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -7489,6 +7489,8 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
case TEMPLATE_PARM_INDEX:
case TRAIT_EXPR:
case IDENTIFIER_NODE:
+ /* We can see a FIELD_DECL in a pointer-to-member expression. */
+ case FIELD_DECL:
return true;
case PARM_DECL:
diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C b/gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C
new file mode 100644
index 0000000..873000b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C
@@ -0,0 +1,9 @@
+// PR c++/49298
+// { dg-options -std=c++0x }
+
+template <class T, int T::*> struct B { };
+template <class T> struct A
+{
+ int i;
+ B<A,&A::i> b;
+};
reply other threads:[~2011-06-06 19:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4DED2DDF.90102@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@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).