From: J D. <ja...@ja...> - 2005-02-25 21:01:22
|
has anyone thought about integrating boosts spirit/wave with openc++ wave is a fully ansi compliant preprocessor as far as i understand Ive been thinking about adding metaobjects to a modified wave preprocessor, openc++ just doesnt have a powerfull enough parser Stefan Seefeld wrote: > Alexander Vodomerov wrote: > >> Recently, I've found that OpenC++ (2.8) can not parse following code: >> >> class X >> { >> public: >> template <typename T> int g() { return 123; } >> }; >> >> template <typename T> class A >> { >> public: >> X x; >> X& getx() { return x; } >> void f() { getx().g<T>(); } >> }; >> >> int main() >> { >> A<int> a; >> a.f(); >> } >> >> It says: >> [alex@lorien ~]$ ./occ -c 1.cpp >> 1.cpp: In member function `void A<T>::f()': >> 1.cpp:12: error: parse error before `;' token >> >> The 12th line corresponds to getx().g<T>() >> >> Is this a correct code? I have 4 compilers on my machine (gcc 3.3.5, >> gcc 3.4.3, gcc 4.0.0 snapshot, Intel C/C++ 8.1). All of them >> compile this code cleanly. > > > The OpenC++ parser is indeed not powerful enough to understand that line. > The reason is that to be able to decide whether '<' is a relational > operator > or the start of a template parameter spec, it has to figure out what 'g' > is. That requires symbol lookup, which OpenC++ doesn't do during parsing. > > Regards, > Stefan > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Opencxx-users mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/opencxx-users > |