I'm the following version of gcc (as reported by gcc_select) gcc version 3.3 20030304 (Apple Computer, Inc. build 1495) My system is (as reported by "About This Mac"): Model: PowerBook G4 17" Operating system: Mac OS X Version 10.3.4 Processor: 1 GHz PowerPC G4 1 MB L3 cache Memory: 1 GB DDR SDRAM gcc was configured / built / installed by the Mac developer tools install program. the command line that triggers the bug is: g++ main.cpp compiler output (from g++ -v -save-temps main.cpp): Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs Thread model: posix gcc version 3.3 20030304 (Apple Computer, Inc. build 1495) /usr/libexec/gcc/darwin/ppc/3.3/cc1plus -E -D__GNUG__=3 -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 -D__APPLE_CC__=1495 -D__DYNAMIC__ main.cpp -fPIC -D__private_extern__=extern main.ii ignoring nonexistent directory "/usr/ppc-darwin/include" ignoring nonexistent directory "/Local/Library/Frameworks" #include "..." search starts here: #include <...> search starts here: /usr/include/gcc/darwin/3.3/c++ /usr/include/gcc/darwin/3.3/c++/ppc-darwin /usr/include/gcc/darwin/3.3/c++/backward /usr/local/include /usr/include/gcc/darwin/3.3 /usr/include End of search list. Framework search starts here: /System/Library/Frameworks /Library/Frameworks End of framework search list. /usr/libexec/gcc/darwin/ppc/3.3/cc1plus -fpreprocessed main.ii -fPIC -quiet -dumpbase main.cpp -auxbase main -version -D__private_extern__=extern -o main.s GNU C++ version 3.3 20030304 (Apple Computer, Inc. build 1495) (ppc-darwin) compiled by GNU C version 3.3 20030304 (Apple Computer, Inc. build 1495). GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=131072 main.cpp: In function `int main()': main.cpp:28: error: variable declaration is not allowed here my actual source code (which contains no includes or anything, but does contain examples): template <typename T> class ParameterMember{ private: T m_T_inst; public: ParameterMember(const T& T_inst): m_T_inst(T_inst){} }; typedef ParameterMember<int> PrimitiveMember; typedef ParameterMember<PrimitiveMember> InstanceMember; int main(){ //---------------------------------------------------------------------------- // this doesn't compile; "error: variable declaration is not allowed here" ParameterMember<InstanceMember> x(InstanceMember(PrimitiveMember(10))); //---------------------------------------------------------------------------- // why is variable declaration not allowed above? //---------------------------------------------------------------------------- // this compiles // ParameterMember<IntstanceMember> is constructed as a temporary // ParameterMember<InstanceMember>(InstanceMember(PrimitiveMember(10))); //---------------------------------------------------------------------------- // this compiles // default assignment of temporary to declared variable... (initialization?) // ParameterMember<InstanceMember> x = ParameterMember<InstanceMember>(InstanceMember(PrimitiveMember(10))); //---------------------------------------------------------------------------- // this compiles // ParameterMember<InstanceMember> is constructed from a temporary InstanceMember // PrimitiveMember prm(10); // ParameterMember<InstanceMember> pm1(InstanceMember(prm)); //---------------------------------------------------------------------------- // this compiles // IntanceMember is constructed from a temporary PrimitiveMember // InstanceMember im(PrimitiveMember(10)); // ParameterMember<InstanceMember> pm2(im); //---------------------------------------------------------------------------- }
*** This bug has been marked as a duplicate of 11796 ***
Note that this is actually not exactly the same bug as in PR 11796, but falls into the same class of things that were fixed in gcc 3.4. You can learn more about this in the release notes for gcc3.4, to be found somewhere on http://gcc.gnu.org. W.
Actually it is the same, as "InstanceMember(PrimitiveMember (x))" is the same as int(int(x)).