public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Confusing errormessage with implicit typename
       [not found] <E1C2new-0007o7-00@deer.gmane.org>
@ 2004-09-04  0:28 ` James E Wilson
  2004-09-04  0:38   ` Joe Buck
  2004-09-04 15:41   ` Nicolas Pavlidis
  0 siblings, 2 replies; 5+ messages in thread
From: James E Wilson @ 2004-09-04  0:28 UTC (permalink / raw)
  To: Nicolas Pavlidis; +Cc: gcc

Nicolas Pavlidis wrote:
> /home/pavnic/projects/converter/src/utilities/factory.h:151: warning:
> implicit typename is deprecated, please see the documentation for
> details 

The deprecated feature has been removed, and as a result, we can no 
longer give this warning.  Since we have no code to support implicit 
typename, it is difficult to impossible to give an error complaining 
about when it occurs.

The g++ parser was extensively rewritten between gcc-3.3 and gcc-3.4 in 
order to fix some long standing parsing bugs.  The result is that we 
have much better C++ conformance, but unfortunately, in some cases, the 
warnings/errors aren't going to be as good as they used to be.

We have documented the common problems in the gcc-3.4 release notes.  See
     http://gcc.gnu.org/gcc-3.4/changes.html#cplusplus
Implicit typename is the third bullet.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Confusing errormessage with implicit typename
  2004-09-04  0:28 ` Confusing errormessage with implicit typename James E Wilson
@ 2004-09-04  0:38   ` Joe Buck
  2004-09-04 15:41   ` Nicolas Pavlidis
  1 sibling, 0 replies; 5+ messages in thread
From: Joe Buck @ 2004-09-04  0:38 UTC (permalink / raw)
  To: James E Wilson; +Cc: Nicolas Pavlidis, gcc

On Fri, Sep 03, 2004 at 05:28:43PM -0700, James E Wilson wrote:
> Nicolas Pavlidis wrote:
> > /home/pavnic/projects/converter/src/utilities/factory.h:151: warning:
> > implicit typename is deprecated, please see the documentation for
> > details 
> 
> The deprecated feature has been removed, and as a result, we can no 
> longer give this warning.  Since we have no code to support implicit 
> typename, it is difficult to impossible to give an error complaining 
> about when it occurs.

I don't believe that this is true.  I think that it is possible to improve
the new parser to give better diagnostics.  Mark's focus when he did the
new parser was, naturally, to correctly compile valid code.  The work of
generating really good diagnostics for commonly encountered parse errors
simply has not been done.  If anything, it's easier to do a good job with
a recursive descent parser: if a valid parse cannot proceed, try to make a
good guess about the user's intention.

Competing compilers give error messages like 'foo appears to be a type,
but has not been declared to be a type' in cases like this, and Gerald and
I pushed to get a hack into the old C++ parser to do exactly this.

Consider the following one-line file:

vector<int> foo;

Up through 3.3.x we get

Q.C:1: 'vector' is used as a type, but is not defined as a type.

3.4.x gives

Q.C:1: error: expected constructor, destructor, or type conversion before '<' token
Q.C:1: error: expected `,' or `;' before '<' token

The parser could do a better job here, and as this example shows,
something else besides a constructor, destructor, or type conversion can
appear before a '<': a template name can.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Confusing errormessage with implicit typename
  2004-09-04  0:28 ` Confusing errormessage with implicit typename James E Wilson
  2004-09-04  0:38   ` Joe Buck
@ 2004-09-04 15:41   ` Nicolas Pavlidis
  2004-09-04 15:48     ` Robert Dewar
  1 sibling, 1 reply; 5+ messages in thread
From: Nicolas Pavlidis @ 2004-09-04 15:41 UTC (permalink / raw)
  To: James E Wilson; +Cc: gcc

James E Wilson <wilson@specifixinc.com> writes:

> Nicolas Pavlidis wrote:
> > /home/pavnic/projects/converter/src/utilities/factory.h:151: warning:
> > implicit typename is deprecated, please see the documentation for
> > details
> 
> The deprecated feature has been removed, and as a result, we can no
> longer give this warning.  Since we have no code to support implicit
> typename, it is difficult to impossible to give an error complaining
> about when it occurs.

I know that this was deprecated, but I think if typename is expected at
this point gcc could tell me this, in my example:
error: typename expected but 'iterator' found

> The g++ parser was extensively rewritten between gcc-3.3 and gcc-3.4
> in order to fix some long standing parsing bugs.  The result is that
> we have much better C++ conformance, but unfortunately, in some cases,
> the warnings/errors aren't going to be as good as they used to be.

Mayby it is possible to improve the warning/error messages. It is quite
hard to understand some messages that gcc tells.

> We have documented the common problems in the gcc-3.4 release notes.  See
>      http://gcc.gnu.org/gcc-3.4/changes.html#cplusplus
> Implicit typename is the third bullet.

Thx!

Best regards,
Nicolas

-- 
|     Nicolas Pavlidis       |       Elvis Presly:    |\ |__      |
|   Student of SE  & KM      |      "Into the goto"   | \|__|     |
|  pavnic@sbox.tugraz.at     |       ICQ #320057056      |        |
|-------------------University of Technology, Graz----------------|

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Confusing errormessage with implicit typename
  2004-09-04 15:41   ` Nicolas Pavlidis
@ 2004-09-04 15:48     ` Robert Dewar
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Dewar @ 2004-09-04 15:48 UTC (permalink / raw)
  To: Nicolas Pavlidis; +Cc: James E Wilson, gcc

Nicolas Pavlidis wrote:

> Mayby it is possible to improve the warning/error messages. It is quite
> hard to understand some messages that gcc tells.

Why not take this on as a project? (fixing this particular warning). It's
not that difficult to get into the code, and I think you would find the
effort instructive. Ultimately the most efficient way of getting upgrades
to gcc is to do them yourself (assuming you are not in a mood to pay
someone to do it for you :-)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Confusing errormessage with implicit typename
@ 2004-09-02  9:13 Nicolas Pavlidis
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Pavlidis @ 2004-09-02  9:13 UTC (permalink / raw)
  To: gcc

Hi!

This is my first posting to the list, if I made something wrong please
tell me!

Here's my problem:
Look at this peace of code:

----------8<-------------------snapp------------------------>8----------
typedef std::map<IdentifierType, ObjectCreator> CreationCallbackMap;
typedef CreationCallbackMap::iterator CreationCallbackMapIter; 
   // ^^^^^ Here the keyword 'typename' is missing
----------8<-------------------snipp------------------------>8----------

gcc 3.4.1 told me the following:

----------8<-------------------snapp------------------------>8----------
/home/pavnic/projects/converter/src/utilities/factory.h:151: error: type
`std::map<IdentifierType, ObjectCreator, std::less<IdentifierType>,
std::allocator<std::pair<const IdentifierType, ObjectCreator> > >' is
not derived from type
`Crazy_::Utilities_::ObjectFactory<AbstractProduct, ObjectCreator,
IdentifierType>' 
----------8<-------------------snipp------------------------>8----------

After a diskusion on usenet I found out that gcc 3.2 produces a more
readable message, though it's "only" a warning. Here is it:

----------8<-------------------snapp------------------------>8----------
/home/pavnic/projects/converter/src/utilities/factory.h:151: warning:
`typename  
   std::map<IdentifierType, ObjectCreator, std::less<IdentifierType>, 
   std::allocator<std::pair<const IdentifierType, ObjectCreator> >
>::iterator'  
   is implicitly a typename
/home/pavnic/projects/converter/src/utilities/factory.h:151: warning:
implicit typename is deprecated, please see the documentation for
details 
----------8<-------------------snipp------------------------>8----------

I don't know if there are other examples where errormessages got a
little bit wors in the 3.4x relaase. Maybe it is possible to make gcc
producing more readable errormessases.

Best regards,
Nicolas

P.S. I don't know how difficult it is to change such things, so please
don;t flame me :-)!
-- 
|     Nicolas Pavlidis       |       Elvis Presly:    |\ |__      |
|   Student of SE  & KM      |      "Into the goto"   | \|__|     |
|  pavnic@sbox.tugraz.at     |       ICQ #320057056      |        |
|-------------------University of Technology, Graz----------------|

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-09-04 15:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <E1C2new-0007o7-00@deer.gmane.org>
2004-09-04  0:28 ` Confusing errormessage with implicit typename James E Wilson
2004-09-04  0:38   ` Joe Buck
2004-09-04 15:41   ` Nicolas Pavlidis
2004-09-04 15:48     ` Robert Dewar
2004-09-02  9:13 Nicolas Pavlidis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).