public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/10618] Error message for function declarations with invalid return type could be improved
       [not found] <20030504101600.10618.giovannibajo@libero.it>
@ 2003-08-04  0:39 ` pinskia at physics dot uc dot edu
  2004-02-26 12:55 ` giovannibajo at libero dot it
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-04  0:39 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10618


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4                         |---


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

* [Bug c++/10618] Error message for function declarations with invalid return type could be improved
       [not found] <20030504101600.10618.giovannibajo@libero.it>
  2003-08-04  0:39 ` [Bug c++/10618] Error message for function declarations with invalid return type could be improved pinskia at physics dot uc dot edu
@ 2004-02-26 12:55 ` giovannibajo at libero dot it
  2004-04-28  2:17 ` pinskia at gcc dot gnu dot org
  2004-08-16 10:56 ` giovannibajo at libero dot it
  3 siblings, 0 replies; 10+ messages in thread
From: giovannibajo at libero dot it @ 2004-02-26 12:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-02-26 12:55 -------
I'll be working on this as part of my work on improving error messages in the 
parser.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|gdr at gcc dot gnu dot org  |giovannibajo at libero dot
                   |                            |it


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10618


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

* [Bug c++/10618] Error message for function declarations with invalid return type could be improved
       [not found] <20030504101600.10618.giovannibajo@libero.it>
  2003-08-04  0:39 ` [Bug c++/10618] Error message for function declarations with invalid return type could be improved pinskia at physics dot uc dot edu
  2004-02-26 12:55 ` giovannibajo at libero dot it
@ 2004-04-28  2:17 ` pinskia at gcc dot gnu dot org
  2004-08-16 10:56 ` giovannibajo at libero dot it
  3 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-28  2:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-28 01:57 -------
The second part (the non-template case) of the bug is already fixed in 3.5.0:
pr10618.cc:15: error: `k' in class `B' does not name a type

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2003-12-18 18:21:38         |2004-04-28 01:57:16
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10618


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

* [Bug c++/10618] Error message for function declarations with invalid return type could be improved
       [not found] <20030504101600.10618.giovannibajo@libero.it>
                   ` (2 preceding siblings ...)
  2004-04-28  2:17 ` pinskia at gcc dot gnu dot org
@ 2004-08-16 10:56 ` giovannibajo at libero dot it
  3 siblings, 0 replies; 10+ messages in thread
From: giovannibajo at libero dot it @ 2004-08-16 10:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-08-16 10:56 -------
An easier example is also:

----------------------------------------
ostream& operator<<(ostream& os, const CVector& x);
----------------------------------------

which gives a generic parse error before '&', but should really emit two 
distinct error messages about 'ostream? and 'CVector' being undefined.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10618


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

* [Bug c++/10618] Error message for function declarations with invalid return type could be improved
       [not found] <bug-10618-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2011-09-21 16:00 ` manu at gcc dot gnu.org
@ 2011-09-21 16:09 ` manu at gcc dot gnu.org
  5 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu.org @ 2011-09-21 16:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10618

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #12 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2011-09-21 15:47:39 UTC ---

> If you use 4.7 and instantiate the template the diagnostic is better than
> clang's

So fully FIXED!


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

* [Bug c++/10618] Error message for function declarations with invalid return type could be improved
       [not found] <bug-10618-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2011-09-21 15:48 ` redi at gcc dot gnu.org
@ 2011-09-21 16:00 ` manu at gcc dot gnu.org
  2011-09-21 16:09 ` manu at gcc dot gnu.org
  5 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu.org @ 2011-09-21 16:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10618

--- Comment #11 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2011-09-21 15:46:59 UTC ---
(In reply to comment #10)
> (In reply to comment #9)
> > 
> > The second diagnostic from G++ does not make sense. Clang gives the correct
> > diagnostics in that case.
> 
> Ah, that's because you're using 4.5.2 -- stop it! ;)

Ah, ok, sorry for the noise. I don't have a recent GCC trunk around anymore.
Maybe I will find some free hours to set up one. Or GCC could have an online
demo like http://llvm.org/demo? ;-)


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

* [Bug c++/10618] Error message for function declarations with invalid return type could be improved
       [not found] <bug-10618-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-09-21 15:39 ` manu at gcc dot gnu.org
@ 2011-09-21 15:48 ` redi at gcc dot gnu.org
  2011-09-21 16:00 ` manu at gcc dot gnu.org
  2011-09-21 16:09 ` manu at gcc dot gnu.org
  5 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2011-09-21 15:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10618

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-21 15:38:49 UTC ---
(In reply to comment #9)
> 
> The second diagnostic from G++ does not make sense. Clang gives the correct
> diagnostics in that case.

Ah, that's because you're using 4.5.2 -- stop it! ;)

If you use 4.6 the diagnostics are almost exactly the same as clang's, with and
without 'typename'

If you use 4.7 and instantiate the template the diagnostic is better than
clang's


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

* [Bug c++/10618] Error message for function declarations with invalid return type could be improved
       [not found] <bug-10618-4@http.gcc.gnu.org/bugzilla/>
  2011-09-21 14:56 ` manu at gcc dot gnu.org
  2011-09-21 15:03 ` redi at gcc dot gnu.org
@ 2011-09-21 15:39 ` manu at gcc dot gnu.org
  2011-09-21 15:48 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu.org @ 2011-09-21 15:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10618

--- Comment #9 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2011-09-21 15:30:26 UTC ---
> 
> > test.cc:12:1: error: need ‘typename’ before ‘A<T>::k’ because ‘A<T>’ is a
> > dependent scope
> > test.cc:14:6: error: expected constructor, destructor, or type conversion
> > before ‘func2’
> 
> > Clang gives the correct output:
> > 
> > /tmp/webcompile/_10395_0.cc:12:1: error: missing 'typename' prior to dependent
> > type name 'A<T>::k'
> > A<T>::k func1(); 
> > ^~~~~~~
> > typename 
> > /tmp/webcompile/_10395_0.cc:14:4: error: no type named 'k' in 'B'
> > B::k func2();
> > ~~~^
> > 2 errors generated.
> 
> Huh? This is the same as G++'s output
> 

The second diagnostic from G++ does not make sense. Clang gives the correct
diagnostics in that case.

> If you instantiate the function template G++ trunk gives a better diagnostic
> than clang 3.0

Great! Let's say this is almost fixed then.


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

* [Bug c++/10618] Error message for function declarations with invalid return type could be improved
       [not found] <bug-10618-4@http.gcc.gnu.org/bugzilla/>
  2011-09-21 14:56 ` manu at gcc dot gnu.org
@ 2011-09-21 15:03 ` redi at gcc dot gnu.org
  2011-09-21 15:39 ` manu at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2011-09-21 15:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10618

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-21 14:56:03 UTC ---
(In reply to comment #7)
> (In reply to comment #5)
> > The second part (the non-template case) of the bug is already fixed in 3.5.0:
> > pr10618.cc:15: error: `k' in class `B' does not name a type
> 
> I would say it got broken again (GCC 4.5.2)

That's not the current version, 4.6 and 4.7 have a lot of C++ diagnostic
improvements (although they don't affect this case.)

> test.cc:12:1: error: need ‘typename’ before ‘A<T>::k’ because ‘A<T>’ is a
> dependent scope
> test.cc:14:6: error: expected constructor, destructor, or type conversion
> before ‘func2’
> 
> If one adds the typename as suggested, it gets better but the first part is not
> even reported:
> 
> test.cc:14:1: error: ‘k’ in class ‘B’ does not name a type

That's because you didn't instantiate the function template 'func1'

> Clang gives the correct output:
> 
> /tmp/webcompile/_10395_0.cc:12:1: error: missing 'typename' prior to dependent
> type name 'A<T>::k'
> A<T>::k func1(); 
> ^~~~~~~
> typename 
> /tmp/webcompile/_10395_0.cc:14:4: error: no type named 'k' in 'B'
> B::k func2();
> ~~~^
> 2 errors generated.

Huh? This is the same as G++'s output

If you instantiate the function template G++ trunk gives a better diagnostic
than clang 3.0

t.cc:12:18: error: no type named 'k' in 'struct A<int>'


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

* [Bug c++/10618] Error message for function declarations with invalid return type could be improved
       [not found] <bug-10618-4@http.gcc.gnu.org/bugzilla/>
@ 2011-09-21 14:56 ` manu at gcc dot gnu.org
  2011-09-21 15:03 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu.org @ 2011-09-21 14:56 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10618

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
                 CC|                            |manu at gcc dot gnu.org

--- Comment #7 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2011-09-21 14:39:29 UTC ---
(In reply to comment #5)
> The second part (the non-template case) of the bug is already fixed in 3.5.0:
> pr10618.cc:15: error: `k' in class `B' does not name a type

I would say it got broken again (GCC 4.5.2)

test.cc:12:1: error: need ‘typename’ before ‘A<T>::k’ because ‘A<T>’ is a
dependent scope
test.cc:14:6: error: expected constructor, destructor, or type conversion
before ‘func2’

If one adds the typename as suggested, it gets better but the first part is not
even reported:

test.cc:14:1: error: ‘k’ in class ‘B’ does not name a type


Clang gives the correct output:

/tmp/webcompile/_10395_0.cc:12:1: error: missing 'typename' prior to dependent
type name 'A<T>::k'
A<T>::k func1(); 
^~~~~~~
typename 
/tmp/webcompile/_10395_0.cc:14:4: error: no type named 'k' in 'B'
B::k func2();
~~~^
2 errors generated.


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

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20030504101600.10618.giovannibajo@libero.it>
2003-08-04  0:39 ` [Bug c++/10618] Error message for function declarations with invalid return type could be improved pinskia at physics dot uc dot edu
2004-02-26 12:55 ` giovannibajo at libero dot it
2004-04-28  2:17 ` pinskia at gcc dot gnu dot org
2004-08-16 10:56 ` giovannibajo at libero dot it
     [not found] <bug-10618-4@http.gcc.gnu.org/bugzilla/>
2011-09-21 14:56 ` manu at gcc dot gnu.org
2011-09-21 15:03 ` redi at gcc dot gnu.org
2011-09-21 15:39 ` manu at gcc dot gnu.org
2011-09-21 15:48 ` redi at gcc dot gnu.org
2011-09-21 16:00 ` manu at gcc dot gnu.org
2011-09-21 16:09 ` manu at gcc dot gnu.org

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