using 4.6.0 20101206 (experimental) [trunk revision 167481]: building the open source project, scummvm (http://scummvm.org) trunk revision : 54858 matt@matt-desktop:~/src/scummvm$ CXX=/usr/lib/gcc-snapshot/bin/g++ ./configure --enable-all-engines [...] matt@matt-desktop:~/src/scummvm$ make [...] In file included from ./engines/scumm/player_v4a.h:32:0, from engines/scumm/player_v4a.cpp:27: ./sound/mods/tfmx.h:115:2: error: expected ';' after struct definition ./sound/mods/tfmx.h:115:11: error: ISO C++ forbids declaration of '_resource' with no type [-fpermissive] [ ... and then several more compile errors that snowball from the first one ... ] The code in question looks like this: struct MdatResource { const byte *mdatAlloc; ///< allocated Block of Memory const byte *mdatData; ///< Start of mdat-File, might point before mdatAlloc to correct Offset uint32 mdatLen; uint16 headerFlags; // uint32 headerUnknown; // char textField[6 * 40]; struct Subsong { uint16 songstart; ///< Index in Trackstep-Table uint16 songend; ///< Last index in Trackstep-Table uint16 tempo; } subsong[kNumSubsongs]; uint32 trackstepOffset; ///< Offset in mdat uint32 sfxTableOffset; uint32 patternOffset[kMaxPatternOffsets]; ///< Offset in mdat uint32 macroOffset[kMaxMacroOffsets]; ///< Offset in mdat void boundaryCheck(const void *address, size_t accessLen = 1) const { assert(mdatAlloc <= address && (const byte *)address + accessLen <= (const byte *)mdatData + mdatLen); } } const *_resource; Configuring with g++-4.5 (4.5.1-7ubuntu2) or g++-4.4 (Ubuntu/Linaro 4.4.4-14ubuntu5) fixes the compilation.
Please provide preprocessed source.
Created attachment 22789 [details] pre-processed source of the file that triggers the compilation regression generated with this commandline using scummvm trunk sources: /usr/lib/gcc-snapshot/bin/g++ -MMD -MF "engines/scumm/.deps/player_v4a.d" -MQ "engines/scumm/player_v4a.o" -MP -Wall -O3 -flto -g -ansi -W -Wno-unused-parameter -Wno-empty-body -pedantic -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder -Wpointer-arith -Wcast-qual -Wshadow -Wimplicit -Wnon-virtual-dtor -Wwrite-strings -fno-rtti -fno-exceptions -fcheck-new -DSCUMMVM_SVN_REVISION=\"54939\" -DHAVE_CONFIG_H -DUNIX -DDATA_PATH=\"/usr/local/share/scummvm\" -DPLUGIN_DIRECTORY=\"/usr/local/lib/scummvm\" -DSDL_BACKEND -DENABLE_SCUMM=STATIC_PLUGIN -DENABLE_SCUMM_7_8 -DENABLE_HE -DENABLE_AGI=STATIC_PLUGIN -DENABLE_AGOS=STATIC_PLUGIN -DENABLE_AGOS2 -DENABLE_CINE=STATIC_PLUGIN -DENABLE_CRUISE=STATIC_PLUGIN -DENABLE_DRACI=STATIC_PLUGIN -DENABLE_DRASCULA=STATIC_PLUGIN -DENABLE_GOB=STATIC_PLUGIN -DENABLE_GROOVIE=STATIC_PLUGIN -DENABLE_GROOVIE2 -DENABLE_HUGO=STATIC_PLUGIN -DENABLE_KYRA=STATIC_PLUGIN -DENABLE_LOL -DENABLE_LASTEXPRESS=STATIC_PLUGIN -DENABLE_LURE=STATIC_PLUGIN -DENABLE_M4=STATIC_PLUGIN -DENABLE_MADE=STATIC_PLUGIN -DENABLE_MOHAWK=STATIC_PLUGIN -DENABLE_PARALLACTION=STATIC_PLUGIN -DENABLE_QUEEN=STATIC_PLUGIN -DENABLE_SAGA=STATIC_PLUGIN -DENABLE_IHNM -DENABLE_SAGA2 -DENABLE_SCI=STATIC_PLUGIN -DENABLE_SCI32 -DENABLE_SKY=STATIC_PLUGIN -DENABLE_SWORD1=STATIC_PLUGIN -DENABLE_SWORD2=STATIC_PLUGIN -DENABLE_SWORD25=STATIC_PLUGIN -DENABLE_TESTBED=STATIC_PLUGIN -DENABLE_TEENAGENT=STATIC_PLUGIN -DENABLE_TINSEL=STATIC_PLUGIN -DENABLE_TOON=STATIC_PLUGIN -DENABLE_TOUCHE=STATIC_PLUGIN -DENABLE_TUCKER=STATIC_PLUGIN -I. -I. -I./engines -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -c engines/scumm/player_v4a.cpp -E > player_v4a.i
Created attachment 22790 [details] original source file
Attached original and pre-processed sources. Re-tested with 4.6.0 20101215, problem is still happening.
A simple testcase: [hjl@gnu-35 rrs]$ cat pr46890.cc struct MdatResource { const char *mdatAlloc; } const *_resource; [hjl@gnu-35 rrs]$ ./166977/usr/bin/gcc -S pr46890.cc pr46890.cc:3:1: error: expected \u2018;\u2019 after struct definition pr46890.cc:3:10: error: ISO C++ forbids declaration of \u2018_resource\u2019 with no type [-fpermissive] [hjl@gnu-35 rrs]$ It is caused by revision 166977: http://gcc.gnu.org/ml/gcc-cvs/2010-11/msg00866.html
Created attachment 23028 [details] gcc46-pr46890.patch Untested fix.
Reassigning back to Nathan, he apparently posted a patch at: http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01398.html with feedback at: http://gcc.gnu.org/ml/gcc-patches/2011-01/msg00252.html
Waiting on Jason to approve feedback-modified patch: http://gcc.gnu.org/ml/gcc-patches/2011-01/msg01667.html
Still reproducible with this version: g++ (Ubuntu/Linaro 20110126-0ubuntu1) 4.6.0 20110126 (experimental) [trunk revision 169283]
Author: froydnj Date: Thu Feb 3 17:16:17 2011 New Revision: 169797 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169797 Log: gcc/c-family/ PR c++/46890 * c-common.h (keyword_is_decl_specifier): Declare. * c-common.c (keyword_is_decl_specifier): Define. (keyword_is_function_specifier): New function. gcc/cp/ PR c++/46890 * parser.c (cp_parser_class_specifier): Fix setting of want_semicolon. gcc/testsuite/ PR c++/46890 * g++.dg/parser/semicolon3.C: Adjust. * g++.dg/parser/semicolon4.C: New testcase. * g++.dg/pr46890.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/parse/semicolon4.C trunk/gcc/testsuite/g++.dg/pr46890.C Modified: trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c-common.c trunk/gcc/c-family/c-common.h trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/parse/semicolon3.C
Fixed.
Verified fixed in 4.6.0.