This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/25191] exception_defines.h #defines try/catch
- From: "hhinnant at apple dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Jan 2006 15:30:15 -0000
- Subject: [Bug libstdc++/25191] exception_defines.h #defines try/catch
- References: <bug-25191-11686@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #22 from hhinnant at apple dot com 2006-01-11 15:30 -------
Conforming C++ programs exist that work correctly with -fno-exceptions as long
as they don't include any libstdc++ header. These same programs can fail (at
either compile time or run time) if they also include some (not all) libstdc++
header.
For example:
#include <stdio.h>
#define glue(a, b) a ## b
#define xglue(a, b) glue(a, b)
#define tryLOW "hello"
#define LOW LOW ", world"
int main()
{
printf("%s\n", xglue(try, LOW));
}
This is a conforming C++ program. It should run and print out:
hello, world
And it does so for gcc whether or not -fno-exceptions.
However if the same program includes <vector> or <iostream> (just as an
example), then the program runs only if -fno-exceptions is not specified.
Otherwise:
/Volumes/Data/Development/XcTest/main.cpp:12:1: error: pasting ")" and "LOW"
does not give a valid preprocessing token
/Volumes/Data/Development/XcTest/main.cpp: In function 'int main()':
/Volumes/Data/Development/XcTest/main.cpp:12: error: expected
primary-expression before 'if'
#define'ing try and catch is non-conforming.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25191