On Wed, Apr 3, 2013 at 10:44 PM, Dave Korn <dave.korn.cyg...@gmail.com> wrote: > > Hi list, > > Previously (tested with gcc-4.5.3), constructs like this:- > > -- foo.h > > struct sigpacket > { > int __stdcall process () __attribute__ ((regparm (1))); > }; > > -- foo.cpp > > #include "foo.h" > > int __stdcall > sigpacket::process () > { > return 2; > } > > -------------------------- > > ... used to work, with the attribute from the declaration being applied also > to the definition. > >> $ g++-4 --version >> g++-4 (GCC) 4.5.3 >> Copyright (C) 2010 Free Software Foundation, Inc. >> This is free software; see the source for copying conditions. There is NO >> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. >> >> >> $ g++-4 -W -Wall -c foo.cc -o foo.o >> > > With >= gcc-4.7, this results in an error: > >> $ /usr/bin/g++-4 --version >> g++-4 (GCC) 4.7.2 >> Copyright (C) 2012 Free Software Foundation, Inc. >> This is free software; see the source for copying conditions. There is NO >> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. >> >> >> $ /usr/bin/g++-4 -W -Wall -c foo.cc -o foo.o >> foo.cc:4:21: error: new declaration 'int sigpacket::process()' >> In file included from foo.cc:1:0: >> foo.h:3:17: error: ambiguates old declaration 'int sigpacket::process()' >> >> $ > > I can't find any reference to this changed behaviour in the 4.7 or 4.8 > changes.html; was it intentional? > > cheers, > DaveK >
Someone else just asked not too long ago: http://gcc.gnu.org/ml/gcc-help/2013-03/msg00012.html