public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11866] New: poor diagnostic on undeclared exception
@ 2003-08-09 12:11 Rob_Davies at NTLworld dot com
  2003-08-09 12:48 ` [Bug c++/11866] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Rob_Davies at NTLworld dot com @ 2003-08-09 12:11 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=11866

           Summary: poor diagnostic on undeclared exception
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Rob_Davies at NTLworld dot com
                CC: gcc-bugs at gcc dot gnu dot org

This appears to be a default diagnostic and not very helpful.  I stumbled into 
it trying examples out of Stroustrup's C++ 3rd edition book (p 54) which fails 
to show inclusion of <stdexcept>, and I thought the class vector must define it 
in it's include file, so was flummoxed. 
 
rob@elm:/dl/rob/usp/cpp> g++ -DBREAK undeclared_exception.cpp 
undeclared_exception.cpp: In function `int main()': 
undeclared_exception.cpp:10: error: parse error before `)' token 
rob@elm:/dl/rob/usp/cpp> 
 
Reproduce with this code : 
 
#ifndef BREAK 
#include <stdexcept> 
#endif /* BREAK */ 
 
int main () { 
 
    try { 
        // something 
    } 
    catch (std::out_of_range) { 
    } 
    catch (...) { 
    } 
 
    return 0; 
} 
 
Anyway the point is, it would help the user lots to understand the problem, if 
a more informative message was given, as is usually the case eg) : 
 
3.cpp:27: error: 'map' is used as a type, but is not defined as a type. 
3.cpp: In function `void print_entry(std::basic_string<char, 
   std::char_traits<char>, std::allocator<char> >)': 
3.cpp:30: error: `phone_book' undeclared (first use this function) 
3.cpp:30: error: (Each undeclared identifier is reported only once for each 
   function it appears in.) 
 
Ideally something like : 
 
'std::out_of_range' is used as an exception, but is not defined as an exception 
. 
In function .... 
XX: error: 'std::out_of_range' undeclared (first use this function) 
... 
 
Thanks for the software, hope you can see how this would be an improvement. 
 
Rob


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

end of thread, other threads:[~2003-12-28 22:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-09 12:11 [Bug c++/11866] New: poor diagnostic on undeclared exception Rob_Davies at NTLworld dot com
2003-08-09 12:48 ` [Bug c++/11866] " pinskia at gcc dot gnu dot org
2003-08-11 14:58 ` bangerth at dealii dot org
2003-08-11 19:15 ` Rob_Davies at NTLworld dot com
2003-08-11 21:05 ` bangerth at dealii dot org
2003-08-11 21:06 ` pinskia at gcc dot gnu dot org
2003-08-11 21:28 ` pinskia at gcc dot gnu dot org
2003-08-11 22:32 ` Rob_Davies at NTLworld dot com
2003-12-28 23:08 ` pinskia 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).