Hi,

On 08/22/2012 04:09 PM, Jason Merrill wrote:
On 08/22/2012 08:43 AM, Paolo Carlini wrote:
yesterday I had a look to this old PR and noticed that we are almost
doing already the right thing for the original testcase: we are for
classes, but we ICE (something recent) for enums. The latter issue seems
easy to fix: handle specially enums at the beginning of
supplement_binding_1 only when the comment says, that is in templates
(otherwise we hit an assert in dependent_type_p).

Which assert? The underlying type ought to be set by the time we see a using, and it shouldn't be a TEMPLATE_TYPE_PARM.
Here:

  if (!processing_template_decl)
    {
      /* If we are not processing a template, then nobody should be
     providing us with a dependent type.  */
      gcc_assert (type);
gcc_assert (TREE_CODE (type) != TEMPLATE_TYPE_PARM || is_auto (type));
      return false;
    }

type is NULL_TREE. Makes sense?

Then, Comment #4 in the audit trail added a case of duplicate using
declaration which we should also reject, involving VAR_DECLs at function
scope (C++11 7.3.3/10). Seems also easy to fix, by checking the return
value of validate_nonmember_using_decl at the beginning of
do_local_using_decl and erroring out if it's null.

Let's put the error in validate_nonmember_using_decl with the other errors.
Ok. Indeed, I wanted to do that, but was annoyed that we cannot assume we are in a function, because validate_nonmember_using_decl is also called by do_toplevel_using_decl. I suppose I should use at_function_scope_p () then.

Paolo.

Reply via email to