From: Zack Weinberg <zack@codesourcery.com> To: ediaz@veridis.com Cc: gcc-gnats@gcc.gnu.org Subject: Re: preprocessor/9689: Number: 9688 update : pasting "<" and "ValidStruct" does not give a valid preprocessing token Date: Thu, 13 Feb 2003 08:56:00 -0800 ediaz@veridis.com writes: > > #define CM(x) \ > template<> \ > class C < ##x > \ This is a shining example of a totally unnecessary use of ##. Just remove it and your code will work. zw
c&p of the #9688 descripton : When I try to compile a file using macros of templates, I get a 'MyFileStruct.h:541:67: pasting "<" and "MyStruct" does not give a valid preprocessing token' message. It worked perfectly with the 2.95.x serie and with the 3.2.1 version. I've tryied to do it in two passes, with a --save-temps and a g++ thefile.ii -c and it worked. Like if the processed code was not the same as the preprocessor's output. ----------- I've made a better & cleaner example and attached it : Release: g++ (GCC) 3.3 20030212 (prerelease) Environment: SuSE 7.3/Linux How-To-Repeat: Explanations in test2.cpp
Fix: Use the two passes trick.
State-Changed-From-To: open->closed State-Changed-Why: Not a bug.
Reopening to mark as a dup of ...
bug 7976. *** This bug has been marked as a duplicate of 7976 ***