diff mbox

[C++] PR c++/51188

Message ID CAFH4-djQfsm-bYb5j-Hz=E01-O+0Xry5a7W7x4uzSJkTnrCuMA@mail.gmail.com
State New
Headers show

Commit Message

Fabien Chêne Nov. 18, 2011, 10:18 a.m. UTC
Hi,

As discussed in the audit trail, here is a patch that fixes this PR
and all its duplicates.
Tested x86_64-unknown-linux-gnu without regressions. OK to commit ?

gcc/testsuite/ChangeLog

2011-11-18  Fabien Chêne  <fabien@gcc.gnu.org>

	PR c++/51188
	* g++.dg/lookup/using46.C: New.
	* g++.dg/lookup/using47.C: New.
	* g++.dg/lookup/using48.C: New.
	* g++.dg/lookup/using49.C: New.
	* g++.dg/lookup/using50.C: New.

gcc/cp/ChangeLog

2011-11-18  Fabien Chêne  <fabien@gcc.gnu.org>

	PR c++/51188
	* search.c (lookup_field_1): Handle USING_DECLs for the storted
	case.

Comments

Jason Merrill Nov. 18, 2011, 12:59 p.m. UTC | #1
On 11/18/2011 05:18 AM, Fabien Chêne wrote:
> +template<  size_t, size_t>  struct AlignedBuffer;
> +template<  size_t size>  struct AlignedBuffer
> +<  size, 8>  {
> +};

This testcase will break on targets where alignof(void*) != 8; just 
define the base template and remove the partial specialization.

OK with that change.

Jason
Fabien Chêne Nov. 18, 2011, 7:53 p.m. UTC | #2
2011/11/18 Jason Merrill <jason@redhat.com>:
> On 11/18/2011 05:18 AM, Fabien Chêne wrote:
>>
>> +template<  size_t, size_t>  struct AlignedBuffer;
>> +template<  size_t size>  struct AlignedBuffer
>> +<  size, 8>  {
>> +};
>
> This testcase will break on targets where alignof(void*) != 8; just define
> the base template and remove the partial specialization.

Good catch, fixed.

> OK with that change.

I have just committed. Unfortunately, I have mentioned the wrong PR
number in the ChangeLog. Consequently, Bugzilla isn't quite happy,
shall I adjust the previous commit with the good PR number (51188) ?
Jason Merrill Nov. 18, 2011, 8:17 p.m. UTC | #3
On 11/18/2011 02:53 PM, Fabien Chêne wrote:
> I have just committed. Unfortunately, I have mentioned the wrong PR
> number in the ChangeLog. Consequently, Bugzilla isn't quite happy,
> shall I adjust the previous commit with the good PR number (51188) ?

Yes, do adjust the ChangeLog.  I do this periodically, too...

Jason
diff mbox

Patch

Index: gcc/testsuite/g++.dg/debug/using6.C
===================================================================
--- gcc/testsuite/g++.dg/debug/using6.C	(revision 0)
+++ gcc/testsuite/g++.dg/debug/using6.C	(revision 0)
@@ -0,0 +1,22 @@ 
+// PR c++/51189
+// { dg-do compile }
+
+struct A
+{
+  int i1, i2, i3, i4, i5, i6;
+};
+
+struct B : A
+{
+  using A::i1;
+  using A::i2;
+  using A::i3;
+  using A::i4;
+  using A::i5;
+  using A::i6;
+};
+
+struct C : B
+{
+  using B::i1;
+};
Index: gcc/testsuite/g++.dg/lookup/using49.C
===================================================================
--- gcc/testsuite/g++.dg/lookup/using49.C	(revision 0)
+++ gcc/testsuite/g++.dg/lookup/using49.C	(revision 0)
@@ -0,0 +1,20 @@ 
+// PR c++/51188
+// { dg-do compile }
+
+#include <utility>
+class XBase {
+public:
+   virtual ~XBase() = 0;
+   enum ImpMode { Imp1, Imp2, Imp3 };
+};
+class X : public XBase {
+   class XBlock {};
+   using XBase::ImpMode;
+   using XBase::Imp3;
+   using XBase::Imp1;
+   using XBase::Imp2;
+   int _XBlocked;
+   std::pair<int,int> getImp(void) const {
+      return (std::make_pair(0, static_cast<int>(X::Imp1)));
+   }
+};
Index: gcc/testsuite/g++.dg/lookup/using46.C
===================================================================
--- gcc/testsuite/g++.dg/lookup/using46.C	(revision 0)
+++ gcc/testsuite/g++.dg/lookup/using46.C	(revision 0)
@@ -0,0 +1,65 @@ 
+// PR c++/51141
+// { dg-do compile }
+// { dg-options "-fpermissive -w -Werror" }
+
+typedef int size_t;
+template < size_t, size_t > struct AlignedBuffer;
+template < size_t size > struct AlignedBuffer 
+         < size, 8 > {
+};
+
+template < typename > class VectorBufferBase
+{
+public:
+    allocateBuffer (size_t) {
+    }
+    buffer () {
+    }
+    *m_buffer;
+    size_t m_capacity;
+};
+
+template < typename T, size_t > class VectorBuffer:VectorBufferBase < T >
+{
+    typedef VectorBufferBase < T > Base;
+
+public:
+    VectorBuffer () {
+    }
+    allocateBuffer (size_t) {
+        m_capacity = 0;
+    }
+    Base::buffer;
+    Base::m_buffer;
+    Base::m_capacity;
+    size_t m_inlineBufferSize;
+
+    AlignedBuffer < 0, __alignof__ (T) > m_inlineBuffer;
+};
+
+template < typename T, size_t > class Vector
+{
+    typedef VectorBuffer < T,
+            0 > Buffer;
+public:
+    void shrinkCapacity (size_t);
+
+    clear () {
+        shrinkCapacity (0);
+    }
+    Buffer m_buffer;
+};
+
+template < typename T, size_t inlineCapacity > void Vector < T,
+         inlineCapacity >::shrinkCapacity (size_t)
+{
+    m_buffer.allocateBuffer (0);
+}
+
+struct PatternDisjunction;
+struct YarrPattern {
+    reset () {
+        m_disjunctions.clear ();
+    }
+    Vector < PatternDisjunction *, 0 > m_disjunctions;
+};
Index: gcc/testsuite/g++.dg/lookup/using47.C
===================================================================
--- gcc/testsuite/g++.dg/lookup/using47.C	(revision 0)
+++ gcc/testsuite/g++.dg/lookup/using47.C	(revision 0)
@@ -0,0 +1,29 @@ 
+// PR c++/51152
+// { dg-do compile }
+
+struct A
+{
+    int a;
+};
+
+struct B
+{
+    int b1;
+    int b2;
+    A b3;
+};
+
+struct C : B
+{
+    typedef int R;
+    typedef int S;
+    typedef int T;
+    using B::b1;
+    using B::b2;
+    using B::b3;
+    void f()
+    {
+        b3.a;
+	b3.~A();
+    }
+};
Index: gcc/testsuite/g++.dg/lookup/using48.C
===================================================================
--- gcc/testsuite/g++.dg/lookup/using48.C	(revision 0)
+++ gcc/testsuite/g++.dg/lookup/using48.C	(revision 0)
@@ -0,0 +1,23 @@ 
+// PR c++/51190
+// { dg-do compile }
+
+struct A
+{
+  int i;
+};
+
+template<typename> struct B
+{
+  A* p;
+};
+
+template<typename T> struct C : B<T>
+{
+  using B<T>::p;
+
+  C() { p->i; }
+
+  int i1, i2, i3, i4, i5;
+};
+
+C<A> c;
Index: gcc/cp/search.c
===================================================================
--- gcc/cp/search.c	(revision 181386)
+++ gcc/cp/search.c	(working copy)
@@ -436,6 +436,14 @@  lookup_field_1 (tree type, tree name, bo
 		    field = fields[i++];
 		  while (i < hi && DECL_NAME (fields[i]) == name);
 		}
+
+	      if (field)
+	      	{
+	      	  field = strip_using_decl (field);
+	      	  if (is_overloaded_fn (field))
+	      	    field = NULL_TREE;
+	      	}
+
 	      return field;
 	    }
 	}