public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49027] New: g++ ignores -fno-exceptions in uninstantiated template
@ 2011-05-17 17:17 ian at airs dot com
2011-05-18 10:04 ` [Bug c++/49027] " rguenth at gcc dot gnu.org
2011-05-18 17:58 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: ian at airs dot com @ 2011-05-17 17:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49027
Summary: g++ ignores -fno-exceptions in uninstantiated template
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ian@airs.com
This file compiles without error when using -fno-exceptions:
extern int f2();
template<typename T>
void f1() {
try { f2(); } catch (...) { }
}
Compiling this very similar file:
extern int f2();
template<typename T>
void f1() {
try { f2(); } catch (...) { }
}
template f1<int>();
gives these errors:
foo.cc: In function ‘void f1() [with T = int]’:
foo.cc:6: instantiated from here
foo.cc:4: error: exception handling disabled, use -fexceptions to enable
I think it would be more consistent for g++ to reject uses of try/catch when
compiling with -fno-exceptions even in uninstantiated templates. Otherwise you
can get surprising results when code changes: you can find problems in very
different pieces of code.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/49027] g++ ignores -fno-exceptions in uninstantiated template
2011-05-17 17:17 [Bug c++/49027] New: g++ ignores -fno-exceptions in uninstantiated template ian at airs dot com
@ 2011-05-18 10:04 ` rguenth at gcc dot gnu.org
2011-05-18 17:58 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-18 10:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49027
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-18 09:43:37 UTC ---
I'm not sure. What about
extern int f2();
struct NoExcept {};
template<typename T>
void f1() {
try { f2(); } catch (...) { }
}
template<>
void f1<NoExcept>() {
f2();
}
template f1<NoExcept>();
? EH code could be disabled by some tags and specialization. Especially
for a library that has a non-exception variant that would sound useful.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/49027] g++ ignores -fno-exceptions in uninstantiated template
2011-05-17 17:17 [Bug c++/49027] New: g++ ignores -fno-exceptions in uninstantiated template ian at airs dot com
2011-05-18 10:04 ` [Bug c++/49027] " rguenth at gcc dot gnu.org
@ 2011-05-18 17:58 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-05-18 17:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49027
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-05-18 17:36:18 UTC ---
IIRC this was done on purpose but I cannot find the original discussion.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-18 17:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-17 17:17 [Bug c++/49027] New: g++ ignores -fno-exceptions in uninstantiated template ian at airs dot com
2011-05-18 10:04 ` [Bug c++/49027] " rguenth at gcc dot gnu.org
2011-05-18 17:58 ` pinskia 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).