This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Bug or feature? C++ code that no longer compiles under GCC 4.2
- From: Daniel Drake <ddrake at brontes3d dot com>
- To: Jonathan Adamczewski <jadamcze at utas dot edu dot au>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 30 Aug 2007 09:06:48 -0400
- Subject: Re: Bug or feature? C++ code that no longer compiles under GCC 4.2
- References: <1188420167.8141.3.camel@localhost> <46D609E5.3030807@utas.edu.au>
On Thu, 2007-08-30 at 10:05 +1000, Jonathan Adamczewski wrote:
> I don't have gcc-4.2 handy - does changing this to a const reference
> solve the problem? i.e
>
> template<typename Op>
> void foo(const Op& op) { op(); }
Thanks for the suggestion, it doesn't help:
test.cpp: In member function 'void My::test()':
test.cpp:12: error: invalid initialization of non-const reference of
type 'void (&)()' from a temporary of type 'void ()()'
test.cpp:4: error: in passing argument 1 of 'void foo(const Op&) [with
Op = void ()()]'
--
Daniel Drake
Brontes Technologies, A 3M Company
http://www.brontes3d.com/opensource