* C++ PATCH for c++/49298 (C++0x regression with pointer to member)
@ 2011-06-06 19:43 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2011-06-06 19:43 UTC (permalink / raw)
To: gcc-patches List
[-- 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;
+};
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-06-06 19:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-06 19:43 C++ PATCH for c++/49298 (C++0x regression with pointer to member) Jason Merrill
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).