octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #34201] Build fail with -std=c++0x flag


From: Júlio Hoffimann
Subject: Re: [bug #34201] Build fail with -std=c++0x flag
Date: Sun, 4 Sep 2011 15:48:31 -0300

Hi John, :-)

As i tried on code sprint, if we remove the const qualifier at line 44 in the test case, GCC will not complain about this. I don't know if it makes sense tough. By fixing this one, the build will invoke another errors related to the same function.

I really need to read a good book on templates before anything, but let me ask you anyway... At line 42 we're passing R fun (X) as a template argument, so this "function", at first glance, could change the state of X. After we're passing const Array<X>& as argument. Seems a contradiction to have a const Array there?

Another possibility could be related somehow to an implicit promotion. Since the constructor prototype is std::complex<T>(const T& re = T(), const T& im = T() ), we don't need to provide a second argument for it: std::complex<double> c(1.0); // (1.0, 0.0)

....Oh, i just tried right now to pass std::conj<double> at line 72 and the compilation was successful. Maybe this is the solution? Have to try it on Octave code later...

Using -std=c++0x for a while, i never had any problem. By the way, the standard is officially approved:

http://herbsutter.com/2011/08/12/we-have-an-international-standard-c0x-is-unanimously-approved/

GCC (4.5.2) documentation on c++0x option is old. :-)

Regards,
Júlio.

2011/9/4 John W. Eaton <address@hidden>
Follow-up Comment #1, bug #34201 (project octave):

I'm attaching a smaller example extracted from Octave that also demonstrates
the problem.  It may be possible to further simplify it, but I don't have time
at the moment.  Compiling with the -std=c++0x option generates the ambiguity
error.  Leaving out that option allows the file to compile.  I'm not sure
whether this is a bug in g++ or a change in the way C++ resolves overloaded
functions.

(file #23936)
   _______________________________________________________

Additional Item Attachment:

File name: foo.cc                         Size:1 KB


   _______________________________________________________

Reply to this item at:

 <http://savannah.gnu.org/bugs/?34201>

_______________________________________________
 Message sent via/by Savannah
 http://savannah.gnu.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]