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 libstdc++/25191] exception_defines.h #defines try/catch



------- 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



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