[GiNaC-devel] is_a<function>: C++11 compiler issue?

Richard B. Kreckel kreckel at in.terlu.de
Sat Jul 9 22:21:16 CEST 2016


Hi Vladimir,

On 07/08/2016 10:28 AM, Vladimir V. Kisil wrote:
> 	I am trying to compile the following code:
> 
> #include <ginac/ginac.h>
> using namespace GiNaC;
> using namespace std;
> int main () {
> 	symbol x("x");
> 	ex a=exp(x);
> 	cout << is_a<symbol>(x) << endl;
> 	cout << is_a<function>(a) << endl;
> }
> 
>   If a compiler option -std=gnu++11 is used, I got errors like this:
> 
> test-g.cpp:9:26: error: no matching function for call to 'is_a(GiNaC::ex&)'
> cout << is_a<function>(a) << endl;
> 
>  (see the full log at the end of my message). Compiler complains
>  about is_a<symbol> but is happy with is_a<function>(a).
> 
>   The code can be compiled and run well if  -std=gnu++11 is omitted.
> 
>   Any suggestions?

Sigh. Your using directives cause a name clash about std::function (new
since C++11) and good old class GiNaC::function:
<http://en.cppreference.com/w/cpp/utility/functional/function>.

I recommend that you disambiguate manually.

All my best,
   -richy.
-- 
Richard B. Kreckel
<http://in.terlu.de/~kreckel/>



More information about the GiNaC-devel mailing list