compile fails. Reproducible: Always Steps to Reproduce: 1. Compile wvstreams-4.0.2-r1 with gcc41 Actual Results: compile failure Expected Results: compiled and installed
Created attachment 73511 [details, diff] patch to fix compile errors
This looks good to me. Gene: Did you send the patch upstream? Alin: Could you apply this please?
fixed in -r2 however, it looks strange to me that gcc-4.1 don't accept the original version as valid syntax.
It's not valid syntax... From [class.ctor]: 1 Constructors do not have names. A special declarator syntax using an optional function-specifier (_dcl.fct.spec_) followed by the construc- tor's class name followed by a parameter list is used to declare or define the constructor. In such a declaration, optional parentheses around the constructor class name are ignored. [Example: class C { public: C(); // declares the constructor }; C::C() { } // defines the constructor --end example] From [class.dtor]: 1 A special declarator syntax using an optional function-specifier (_dcl.fct.spec_) followed by ~ followed by the destructor's class name followed by an empty parameter list is used to declare the destructor in a class definition. In such a declaration, the ~ followed by the destructor's class name can be enclosed in optional parentheses; such parentheses are ignored. A typedef-name that names a class is a class-name (_dcl.typedef_); however, a typedef-name that names a class shall not be used as the identifier in the declarator for a destructor declaration.
really? then the rest of C++ compilers must be broken if they accept: class C { public: C::C(); // declares the constructor }; someone should break the news to the rest of the world.
You can do lots of illegal things in most C++ compilers. This isn't exactly the only example of "stuff you can get away with in some compilers that isn't strictly legal". Problem is, sooner or later someone might fix the compiler -- I bet we'll get a whole load more of this kind of thing when g++4 starts to become more widely used.
...and it looks like this generates a warning in icc: warning #470: qualified name is not allowed in member declaration ...and an error in Comeau: error: qualified name is not allowed in member declaration Definitely a code bug, not a compiler bug.
interesting... do you have a quote from ANSI C++ standard that specifies qualified names are not allowed in member declarations?
ok, I've found it in JTC1.22.32 - ISO/IEC 14882 - Programming language C++ draft October 2005, paragraph 8.3.