Preprocessor bug

John Hinke hinke@roguewave.com
Mon Nov 20 17:21:00 GMT 2000


Hi,

I've got a small problem with the GCC preprocessor.  I'm using a recent (1
week old) pull from CVS that demonstrates the problem.  Here is the code
that fails:

#define name2(a,b)  tmpname2(a,b)
#define tmpname2(a,b) a##b

#define declare(Class,type)  name2(Class,declare)(type)

#define MyClassdeclare(type) name2(type,MyClass)

declare(MyClass,int)


Executing "g++ -E bug.cpp" produces:

# 1 "bug.cpp"
# 11 "bug.cpp"
name2(int,MyClass)

However, executing the same line using G++ V2.95.2 produces (which is the
expected output):
# 1 "bug.cpp"

       intMyClass

Any comments?  If I'm doing something wrong, please let me know.  This code
has been working for many years now.  Also, other compilers that I tested
produce the correct (2.95.2) output.

Thanks,

John



More information about the Gcc-bugs mailing list