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


Mark Mitchell <mark@codesourcery.com> writes:

| 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.

The struct stat hack was a necessity at the time C++ was invented.
It isn't anymore.  I know nobody on the C++ committee that believes it
is a good thing to have. To the point that it is explicitly forbidden
in anything "new" C++ has added (e.g. namespaces, templates, etc.)
I believe it would be a mistake for GCC/g++ to relax the diagnostic on
this specific topic.

-- Gaby


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