Patchwork [C++] PR 50491

login
register
mail settings
Submitter Paolo Carlini
Date Sept. 22, 2011, 11:47 p.m.
Message ID <4E7BC920.6080408@oracle.com>
Download mbox | patch
Permalink /patch/116020/
State New
Headers show

Comments

Paolo Carlini - Sept. 22, 2011, 11:47 p.m.
Hi,

the below one-liner appears to fix this regression: to be honest, I 
cannot say to have fully analyzed the issue, but testsuite is fine on 
x86_64-linux, both mainline and 4_6-branch (indeed the latter is also 
affected, 4_4-branch isn't)

Is it Ok? In case, 4_6-branch too?

Thanks,
Paolo.

////////////////////
/cp
2011-09-22  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50491
	* semantics.c (potential_constant_expression_1): Handle USING_DECL.

/testsuite
2011-09-22  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50491
	* g++.dg/cpp0x/pr50491.C: New.
Jason Merrill - Sept. 23, 2011, 12:37 a.m.
OK for trunk and 4.6.

Jason

Patch

Index: testsuite/g++.dg/cpp0x/pr50491.C
===================================================================
--- testsuite/g++.dg/cpp0x/pr50491.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/pr50491.C	(revision 0)
@@ -0,0 +1,17 @@ 
+// { dg-options "-std=c++0x" }
+
+struct GrandParent {
+  void *get();
+};
+
+template<class OBJ>
+struct Parent : public GrandParent{
+};
+
+template<typename T>
+struct Child : public Parent<T> {
+  using GrandParent::get;
+  void Foo() {
+    void* ex = get();
+  }
+};
Index: cp/semantics.c
===================================================================
--- cp/semantics.c	(revision 179103)
+++ cp/semantics.c	(working copy)
@@ -7751,6 +7751,7 @@  potential_constant_expression_1 (tree t, bool want
       /* We can see a FIELD_DECL in a pointer-to-member expression.  */
     case FIELD_DECL:
     case PARM_DECL:
+    case USING_DECL:
       return true;
 
     case AGGR_INIT_EXPR: