Since around 2010/09/07 g++ started to barf on the attached source about a
mismatched prototype. Apparently the culprit is the forward declaration + later
definition with additional attribute of one of the argument, and, if the
forward declaration is sprinkled with said attribute, the error goes away.

I've failed to reduce both manually and with delta (mismatched prototypes are
too easily produced). Sorry.

$ /usr/local/gcc-4.6-20100910/bin/g++ -std=c++0x -c synth.ii
src/audio/synth_voice_impl.h:140:6: error: prototype for 'bool
synth::voice::voice_t::produce_chunk(const synth::semitones_lut_t&, const
synth::midi_channels_params_t&, synth::chunk_array_mono_t&)' does not match any
in class 'synth::voice::voice_t'
src/audio/synth_voice.h:153:156: error: candidate is:
template<synth::voice::waves::waves_enum_t wave_shape> bool
synth::voice::voice_t::produce_chunk(const synth::semitones_lut_t&, const
synth::midi_channels_params_t&, synth::chunk_array_mono_t&)
...
$ /usr/local/gcc-4.6-20100910/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-4.6-20100910/bin/g++
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.6-20100910/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr/local/gcc-4.6.0
--enable-languages=c,c++ --enable-threads=posix --disable-checking
--disable-nls --with-system-zlib --disable-bootstrap --enable-checking=none
--enable-mpfr --enable-gold --enable-lto --with-ppl --with-cloog
--with-arch=native
Thread model: posix
gcc version 4.6.0 20100910 (experimental) (GCC) 

midi_channels_params_t is the trigger.
Known to work on g++ 4.4.x, 4.5.x and up to and including 4.6-20100901.

PS: http://gcc.gnu.org/ml/gcc/2010-09/msg00152.html


-- 
           Summary: g++ 4.6 regression, c++0x, weird mismatch for arguments
                    with forwarded declaration when attributes are involved
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tbptbp at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45642

Reply via email to