Bug 9689 - Number: 9688 update : pasting "<" and "ValidStruct" does not give a valid preprocessing token
Summary: Number: 9688 update : pasting "<" and "ValidStruct" does not give a valid pre...
Status: RESOLVED DUPLICATE of bug 7976
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 3.3
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2003-02-13 10:06 UTC by ediaz
Modified: 2004-09-02 20:37 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
test2.cpp (613 bytes, text/x-c )
2003-05-21 15:17 UTC, ediaz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zack Weinberg 2003-02-13 08:56:00 UTC
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
Comment 1 ediaz 2003-02-13 10:06:01 UTC
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
Comment 2 ediaz 2003-02-13 10:06:01 UTC
Fix:
Use the two passes trick.
Comment 3 Neil Booth 2003-02-13 10:12:49 UTC
State-Changed-From-To: open->closed
State-Changed-Why: Not a bug.
Comment 4 Andrew Pinski 2004-09-02 20:36:47 UTC
Reopening to mark as a dup of ...
Comment 5 Andrew Pinski 2004-09-02 20:37:10 UTC
bug 7976.

*** This bug has been marked as a duplicate of 7976 ***