[GiNaC-devel] is_a<function>: C++11 compiler issue?
Vladimir V. Kisil
kisilv at maths.leeds.ac.uk
Fri Jul 8 10:28:34 CEST 2016
Dear All,
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?
Best wishes,
Vladimir
--
Vladimir V. Kisil http://www.maths.leeds.ac.uk/~kisilv/
Book: Geometry of Mobius Transformations http://goo.gl/EaG2Vu
Software: Geometry of cycles http://moebinv.sourceforge.net/
=====================================================================
test-g.cpp: In function 'int main()':
test-g.cpp:9:10: error: parse error in template argument list
cout << is_a<function>(a) << endl;
^
test-g.cpp:9:26: error: no matching function for call to 'is_a(GiNaC::ex&)'
cout << is_a<function>(a) << endl;
^
In file included from /usr/include/ginac/registrar.h:27:0,
from /usr/include/ginac/basic.h:29,
from /usr/include/ginac/ginac.h:28,
from test-g.cpp:1:
/usr/include/ginac/print.h:181:13: note: candidate: template<class T> bool GiNaC::is_a(const GiNaC::print_context&)
inline bool is_a(const print_context & obj)
^
/usr/include/ginac/print.h:181:13: note: template argument deduction/substitution failed:
test-g.cpp:9:26: error: template argument 1 is invalid
cout << is_a<function>(a) << endl;
^
In file included from /usr/include/ginac/ginac.h:28:0,
from test-g.cpp:1:
/usr/include/ginac/basic.h:311:13: note: candidate: template<class T> bool GiNaC::is_a(const GiNaC::basic&)
inline bool is_a(const basic &obj)
^
/usr/include/ginac/basic.h:311:13: note: template argument deduction/substitution failed:
test-g.cpp:9:26: error: template argument 1 is invalid
cout << is_a<function>(a) << endl;
^
In file included from /usr/include/ginac/ginac.h:30:0,
from test-g.cpp:1:
/usr/include/ginac/ex.h:930:13: note: candidate: template<class T> bool GiNaC::is_a(const GiNaC::ex&)
inline bool is_a(const ex &obj)
^
/usr/include/ginac/ex.h:930:13: note: template argument deduction/substitution failed:
test-g.cpp:9:26: error: template argument 1 is invalid
cout << is_a<function>(a) << endl;
^
More information about the GiNaC-devel
mailing list