Compressed .ii file goes as attachment. gcc 4.3.2: (reports no errors) my gcc: g++ -c kded_kephal_automoc.ii In file included from /src/a/kde/4.1.80/o/kdebase-workplace/libs/kephal/kded_kephal/moc_xmlconfigurations.cpp:11, from /src/a/kde/4.1.80/o/kdebase-workplace/libs/kephal/kded_kephal/kded_kephal_automoc.cpp:6: /src/a/kde/4.1.80/o/kdebase-workplace/libs/kephal/kded_kephal/../../../../../kdebase-workspace-4.1.80/libs/kephal/configurations/xml/xmlconfigurations.h:104: error: expected primary-expression at end of input g++ -v Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: ../svn/configure --prefix=/usr --enable-threads --enable-shared --enable-languages=c,c++ --host=x86_64-unknown-linux-gnu --with-system-zlib --with-x --enable-java-awt=gtk --enable-targets=x86_64-unknown-linux-gnu --with-arch=athlon64 --with-tune=athlon64 --with-cpu=athlon64 --disable-multilib --enable-__cxa_atexit --enable-libada --enable-gtk-cairo --enable-libgcj-multifile --with-long-double-128 --disable-nls Thread model: posix gcc version 4.4.0 20081211 (experimental) (GCC) The problem is at line 9355 of the .ii: (comment it out and it works) void translateToOther(QMap<int, QRect> & layout, Output * base, QMap <int, int> match = (QMap<int, int>())); ...and from what I could figure out, it is the right-side of the '=' default parameter assignment. From my understanding, the code sould be equivalent to this small test case: template <typename T1, typename T2> class blah { T1 whatever1; T2 whatever2; public: inline blah() {} inline T1 get1() { return whatever1; } }; int foo(blah <int, int> bar = (blah <int, int> ())) { return bar.get1(); } int main(void) { return foo(); } However, this code compiles and runs perfectly on my gcc.
Created attachment 16883 [details] the faulty .ii file
Reduced testcase: template <class Key, class T> class QMap { }; class XMLConfigurations { void translateToOther(QMap<int, int> match = (QMap<int, int>())); };
Related to PR 57, one of the oldest GCC bugs which are still opened (there is a defect report against the C++ standard and that is why it is still opened).
Jason since you changed this area for 4.4, do you know if this is valid code or not? Comment #2 contains the reduced testcase. Thanks, Andrew Pinski
I think this testcase is clearly valid.
Fixed.
Subject: Bug 38485 Author: jason Date: Thu Dec 18 15:54:59 2008 New Revision: 142815 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142815 Log: PR c++/38485 * parser.c (cp_parser_token_starts_cast_expression): An EOF can't start a cast-expression. Added: trunk/gcc/testsuite/g++.dg/parse/defarg13.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog