[I am not an expert bug reporter, my apologies if this is a known bug or
incomplete]
1. Description of problem.
Consider test file:
#define INC_X11(aaa) <X11/##aaa##>
#include INC_X11(Xlib.h)
int main() {
return 0;
}
When compiled with gcc -E tst.C, output (some 4300 lines) dumped to stdout looks
fine. However, attempts to redirect output to file with
gcc -E tst.C > tst.E
or writing it to file
gcc -E -o tst.E tst.C
fail with
tst.C:3:1: error: pasting "/" and "Xlib" does not give a valid preprocessing
token
tst.C:3:1: error: pasting "h" and ">" does not give a valid preprocessing token
Similarly, the compilation of the file, i.e.,
gcc -o tst tst.C
also fails with the same error.
2. NOTE: gcc-2.95.3 works fine, both for redirection and actual compilation
------------
3. System information
gcc taken from Fedora Core 4, updated with yum to 4.0.1, gcc -v says:
=====================================================================
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--host=i386-redhat-linux
Thread model: posix
gcc version 4.0.1 20050727 (Red Hat 4.0.1-5)
-----------------
Intel Pentium4 (620) system, Fedore Core 4 linux, updated with yum to current as
of Sep 27 2005, 6pm EST, uname -a says:
=======================================
Linux karman.physics.purdue.edu 2.6.12-1.1447_FC4smp #1 SMP Fri Aug 26 20:57:13
EDT 2005 i686 i686 i386 GNU/Linux
--
Summary: macro - problem with ##
Product: gcc
Version: 4.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: preprocessor
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: molnard at phys dot columbia dot edu
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24098