public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15179] Error message can be improved
       [not found] <bug-15179-6594@http.gcc.gnu.org/bugzilla/>
@ 2007-02-10  9:17 ` pinskia at gcc dot gnu dot org
  2007-02-10  9:17 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-10  9:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from pinskia at gcc dot gnu dot org  2007-02-10 09:17 -------
*** Bug 30754 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |benoit dot hudson at gmail
                   |                            |dot com


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


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

* [Bug c++/15179] Error message can be improved
       [not found] <bug-15179-6594@http.gcc.gnu.org/bugzilla/>
  2007-02-10  9:17 ` [Bug c++/15179] Error message can be improved pinskia at gcc dot gnu dot org
@ 2007-02-10  9:17 ` pinskia at gcc dot gnu dot org
  2008-08-18 17:52 ` [Bug c++/15179] bad parse error recovery with missing typename manu at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-10  9:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from pinskia at gcc dot gnu dot org  2007-02-10 09:16 -------
*** Bug 28182 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |_vi at list dot ru


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


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

* [Bug c++/15179] bad parse error recovery with missing typename
       [not found] <bug-15179-6594@http.gcc.gnu.org/bugzilla/>
  2007-02-10  9:17 ` [Bug c++/15179] Error message can be improved pinskia at gcc dot gnu dot org
  2007-02-10  9:17 ` pinskia at gcc dot gnu dot org
@ 2008-08-18 17:52 ` manu at gcc dot gnu dot org
  2008-11-15  9:55 ` andris dot pavenis at iki dot fi
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-08-18 17:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from manu at gcc dot gnu dot org  2008-08-18 17:51 -------
Let's give meaningful short descriptions to the bugs, please.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Error message can be        |bad parse error recovery
                   |improved                    |with missing typename


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


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

* [Bug c++/15179] bad parse error recovery with missing typename
       [not found] <bug-15179-6594@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2008-08-18 17:52 ` [Bug c++/15179] bad parse error recovery with missing typename manu at gcc dot gnu dot org
@ 2008-11-15  9:55 ` andris dot pavenis at iki dot fi
  2009-08-04  9:22 ` manu at gcc dot gnu dot org
  2009-11-08  4:02 ` jason at gcc dot gnu dot org
  5 siblings, 0 replies; 9+ messages in thread
From: andris dot pavenis at iki dot fi @ 2008-11-15  9:55 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 809 bytes --]



------- Comment #14 from andris dot pavenis at iki dot fi  2008-11-15 09:53 -------
Created an attachment (id=16681)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16681&action=view)
Another C++ example to ilustrate misleading error message about missing
typename keyword

This is a short example where one is getting completely misleeding error
message:

test.cpp:22: error: expected constructor, destructor, or type conversion before
‘&’ token

I had to try to compile this example with Visual C++ to figured out what's the
reason of compiler error was. It reported it more clearly.

Tried:
GNU C++ (GCC) version 4.3.0 20080428 (Red Hat 4.3.0-8) (x86_64-redhat-linux)
GNU C++ version 3.4.6 20060404 (Red Hat 3.4.6-9) (x86_64-redhat-linux)


-- 


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


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

* [Bug c++/15179] bad parse error recovery with missing typename
       [not found] <bug-15179-6594@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2008-11-15  9:55 ` andris dot pavenis at iki dot fi
@ 2009-08-04  9:22 ` manu at gcc dot gnu dot org
  2009-11-08  4:02 ` jason at gcc dot gnu dot org
  5 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-08-04  9:22 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1573 bytes --]



------- Comment #15 from manu at gcc dot gnu dot org  2009-08-04 09:22 -------
Testcase in comment #9 does not produce any output anymore.

Testcase in comment #10 produces:

/home/manuel/src/pr15179.C:8:18: error: type ‘A<yn>’ is not derived from type
‘B<yn>’
/home/manuel/src/pr15179.C:8:23: error: expected ‘;’ before ‘Type’


Testcase in comment #14 produces:

/home/manuel/src/pr15179-3.C: At global scope:
/home/manuel/src/pr15179-3.C:22:23: error: expected constructor, destructor, or
type conversion before ‘&’ token


It seems to me that there is a tentative parse of a type in
cp_parser_decl_specifier_seq, that fails, and then we end up trying to parse
something else until it fails completely.

For the typedef testcases, the code in cp_parser_decl_specifier_seq could just
directly parse the complete typedef and return, because only a type can follow
typedef.

For the non-typedef testcase, it is less clear how to handle a failure to parse
a type, since that may actually mean we are looking at something else.

I don't really know where the "failure" happens. That would need more debugging
that I have time to do now. Any help appreciated.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.4.0
   Last reconfirmed|2005-05-08 17:34:10         |2009-08-04 09:22:11
               date|                            |


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


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

* [Bug c++/15179] bad parse error recovery with missing typename
       [not found] <bug-15179-6594@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2009-08-04  9:22 ` manu at gcc dot gnu dot org
@ 2009-11-08  4:02 ` jason at gcc dot gnu dot org
  5 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-08  4:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from jason at gcc dot gnu dot org  2009-11-08 04:02 -------


*** This bug has been marked as a duplicate of 15946 ***


-- 

jason at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/15179] Error message can be improved
  2004-04-27 20:40 [Bug c++/15179] New: Bad error message igodard at pacbell dot net
  2004-04-27 23:18 ` [Bug c++/15179] Error message can be improved pinskia at gcc dot gnu dot org
  2004-04-28  1:02 ` bangerth at dealii dot org
@ 2004-08-05 11:25 ` redi at gcc dot gnu dot org
  2 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu dot org @ 2004-08-05 11:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From redi at gcc dot gnu dot org  2004-08-05 11:24 -------
It doesn't need to involve nested classes either:
-----------------------------
template <bool>
struct A {
    typedef int type;
};

template <bool yn>
struct B {
    typedef A<yn>::type Type;
};
-----------------------------
3.4 and mainline give:
bug.cc:8: error: type `A<<anonymous> >' is not derived from type `B<yn>'
bug.cc:8: error: ISO C++ forbids declaration of `type' with no type
bug.cc:8: error: expected `;' before "Type"

Again, the problem is a missing "typename" but you can't guess that from the
diagnostic. Compiling the same code with GCC 3.3 gives the "implicit typename
is deprecated" warning which makes the error much easier to find, therefore I
consider this a regression against 3.3


-- 


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


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

* [Bug c++/15179] Error message can be improved
  2004-04-27 20:40 [Bug c++/15179] New: Bad error message igodard at pacbell dot net
  2004-04-27 23:18 ` [Bug c++/15179] Error message can be improved pinskia at gcc dot gnu dot org
@ 2004-04-28  1:02 ` bangerth at dealii dot org
  2004-08-05 11:25 ` redi at gcc dot gnu dot org
  2 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2004-04-28  1:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-04-28 00:00 -------
Confirmed. For this code 
----------- 
template <class T> class O { 
    typedef O<T> Type; 
    typedef int inner; 
    class I 
    { 
        typedef Type::inner inner; 
    }; 
}; 
----------- 
gcc produces 
g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -c x.cc 
x.cc:6: error: type `O<T>' is not derived from type `O<T>::I' 
x.cc:6: error: ISO C++ forbids declaration of `inner' with no type 
x.cc:6: error: expected `;' before "inner" 
 
which is indeed confusing. (icc, for reference, simply accepts the code 
even with -Xc -ansi -- which is probably wrong.) 
 
Frankly, I have no clue what path in the compiler we are taking to get 
to this error message... 
 
W. 

-- 


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


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

* [Bug c++/15179] Error message can be improved
  2004-04-27 20:40 [Bug c++/15179] New: Bad error message igodard at pacbell dot net
@ 2004-04-27 23:18 ` pinskia at gcc dot gnu dot org
  2004-04-28  1:02 ` bangerth at dealii dot org
  2004-08-05 11:25 ` redi at gcc dot gnu dot org
  2 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-27 23:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-27 22:56 -------
Lets keep this for the error message, because PR 9634 is the bug which talks about this 
being not a bug but the standard is not clear.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
           Keywords|rejects-valid               |diagnostic
            Summary|[3.4/3.5 Regression] Rejects|Error message can be
                   |typedef of a type of an     |improved
                   |outerclass                  |
   Target Milestone|3.4.1                       |---


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


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

end of thread, other threads:[~2009-11-08  4:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-15179-6594@http.gcc.gnu.org/bugzilla/>
2007-02-10  9:17 ` [Bug c++/15179] Error message can be improved pinskia at gcc dot gnu dot org
2007-02-10  9:17 ` pinskia at gcc dot gnu dot org
2008-08-18 17:52 ` [Bug c++/15179] bad parse error recovery with missing typename manu at gcc dot gnu dot org
2008-11-15  9:55 ` andris dot pavenis at iki dot fi
2009-08-04  9:22 ` manu at gcc dot gnu dot org
2009-11-08  4:02 ` jason at gcc dot gnu dot org
2004-04-27 20:40 [Bug c++/15179] New: Bad error message igodard at pacbell dot net
2004-04-27 23:18 ` [Bug c++/15179] Error message can be improved pinskia at gcc dot gnu dot org
2004-04-28  1:02 ` bangerth at dealii dot org
2004-08-05 11:25 ` redi at gcc dot gnu dot 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).