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: [PATCH][C++] Fix PR29433, make C++ use a lot less time/memory


Richard Guenther wrote:

> Ok, here's one testcase that fails
> 
> template <class _Tp> class auto_ptr {};
> template <class _Tp>
> class counted_ptr
> {
> public:
>   auto_ptr<_Tp> auto_ptr();
> };

Interesting case.

I see that we already reject the non-template version:

  struct S {};
  struct T {
    S S();
  };

with the same error.

EDG accepts that program.

We're issuing errors based on [basic.scope.class]:

A name N used in a class S shall refer to the same declaration in its
context and when re-evaluated in the completed scope of S. No diagnostic
is required for a violation of this rule.

Because of the last bit, we can be conservative in issuing the error.
Since type names are in a different namespace from variables and
functions (the "stat hack"), we could seperate things into their own
namespaces.

I think that this case:

  template <class T> sturct A {};
  template <class T>
  struct B {
    A<T> f();
    template <typename U>
    class A {};
  };

is in fact invalid, even though EDG allows it, as this changes the
meaning of A in "A<T>".

So, I will work on a change to implement the type names vs. everything
else distinction, which will then hopefully help you move on to the next
issue. :-)

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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