This is the mail archive of the gcc-bugs@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]

[Bug c++/15766] New: Misleading error messages


You can find the diagnostic output at the end of this description.
The following code (ii-file) produces misleading error messages.

>>>>>>>>>>>>>>>>>>> ii-file begin <
# 1 "bug.cc"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "bug.cc"
void confusion1(const A& a) {}
 
void confusion2()
{ for (int i = 0; ; i++;) {}
}
>>>>>>>>>>>>>>>>>>> ii-file end <

The error messages are: 
(1)
bug.cc:1: error: expected `,' or `...' before '&' token
bug.cc:1: error: ISO C++ forbids declaration of `A' with no type

(2)
bug.cc: In function `void confusion2()':
bug.cc:4: error: expected `;' before ';' token
bug.cc:4: error: expected primary-expression before ')' token
bug.cc:4: error: expected `;' before ')' token

suggested behavior:
(1) The first line "bug.cc:1: error: expected `,' or `...' before '&' token"
tells nothing about the real cause and should not be displayed.

(2) produces 3 error messages, where only the second is correct; The other two
should not be displayed.

Thanks,
Peter

*************************** diagnostics *

Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/specs
Configured with: ./configure --disable-libgcj --prefix=/usr/local/ngcc :
(reconfigured) ./configure --prefix=/usr/local --enable-languages=c++
Thread model: posix
gcc version 3.4.0
 /usr/local/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1plus -E -quiet -v
-D_GNU_SOURCE bug.cc -mtune=pentiumpro -o bug.ii
ignoring nonexistent directory
"/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/i686-pc-linux-gnu
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/backward
 /usr/local/include
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/include
 /usr/include
End of search list.
 /usr/local/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1plus -fpreprocessed bug.ii
-quiet -dumpbase bug.cc -mtune=pentiumpro -auxbase bug -version -o bug.s
GNU C++ version 3.4.0 (i686-pc-linux-gnu)
        compiled by GNU C version 3.2.2 20030222 (Red Hat Linux 3.2.2-5).
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64153

-- 
           Summary: Misleading error messages
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: peter dot pirkelbauer at tamu dot edu
                CC: gcc-bugs at gcc dot gnu dot org,gdr at gcc dot gnu dot
                    org


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


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