This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ patch] PR 20420


Hi again,

On 08/22/2012 05:13 PM, Jason Merrill wrote:
On 08/22/2012 10:55 AM, Paolo Carlini wrote:
. thus, in short, what is happening is that, for this testcase:

class B
{
protected:
   enum E { E1, E2, E3 };
};

class D : private B
{
public:
   using B::E;

private:
   enum E { };
};

we parse the new declaration enum E { }; and we reach
supplement_binding_1 before setting the underlying type of the new
declaration. The old declaration is fine, would not ICE dependent_type_p.

So with your change would we still ICE if D were a template? It seems like what we should be checking for is null underlying type.
Good question ;) Yesterday night I double checked with this:

template<typename T>
class BT
{
protected:
  enum E { E1, E2, E3 };
  struct S { int i; E e; };
};

template<typename T>
class DT : private BT<T>
{
public:
  using BT<T>::E;
  using BT<T>::S;

private:
  enum E {};
  struct S {};
};

template class DT<int>;

and we handle it correctly (note: we error out *only* at instantiation time).

At this point, let me know, I could either add to the testcase a templated variant like the above (see attached), or rework the code to explicitly check the underlying type (I would add locals hosting the TREE_TYPEs to shorten a bit things, etc).

The below passes testing, anyway.

Thanks,
Paolo.

///////////////////////

Attachment: patch_20420_2
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]