[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: -pedantic reports ambiguous base



> Without -pedantic there is not even a warning (even with -W -Wall).

> 10.2.1 says "for a qualified-id, name lookup begins in the scope of
> 10.2.the nested-name-specifier".  In which scope, I don't think the
> 10.2.reference to pop() or HWQueue, for that matter, is ambiguous.

This is caused by the fragment in cp/init.c

  /* Convert 'this' to the specified type to disambiguate conversion
     to the function's context.  Apparently Standard C++ says that we
     shouldn't do this.  */
  if (decl == current_class_ref
      && ! pedantic
      && ACCESSIBLY_UNIQUELY_DERIVED_P (type, current_class_type))

It seems there are several interpretations of 10.2/1. GCC's
interpretation is that, indeed, lookup starts in ISPmq, and finds
HwQueue::pop. So the call you have written is equivalent to

  this->HwQueue::pop();

which is ambiguous.

It would be good if you could achieve independent clarification,
e.g. through comp.std.c++. If people are of different opinion there as
well, consider filing a Defect Report. Notice that variations of this
have been discussed repeatedly in comp.stdc.c++; you may want to read
the archives.

Regards,
Martin



Reply to: