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]

potential preprocessor bug in latest g++?



If you try compiling the fragment of code attached to the bottom of this
message, the latest "g++ -E" compiler gives the following error messages (but
does produce the code expected):

gccquery.cpp:16:30: warning: pasting would not give a valid preprocessing token
gccquery.cpp:16:30: warning: pasting would not give a valid preprocessing token

Note that MSVC++ somewhat older versions of g++ both quite happily preprocess
this.

The compiler version:
 Reading specs from /opt/gcc/bin/../lib/gcc-lib/i386-pc-linux-gnu/2.96/specs
 gcc version 2.96 20000719 (experimental)

David Howells
=============

struct IID;

namespace foo {
    struct IBar;
    extern const IID IID_IBar;
}

template<class T> struct com_if_traits {};

#define DECLARE_COM_TRAITS(NAMESPACE,CLASS) \
struct com_if_traits<NAMESPACE ## CLASS> { \
    static inline const IID& GetIID() { return NAMESPACE ## IID_##CLASS; } \
}

DECLARE_COM_TRAITS(foo::,IBar);

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