[GiNaC-devel] MSVC error 2766

Richard B. Kreckel kreckel at in.terlu.de
Sun Feb 13 23:17:30 CET 2022


Hi Jan,

On 13.02.22 21:39, Jan Rheinländer wrote:
> when compiling GiNaC (latest version from git master) with MSVC
> (19.29.30139 for x64) it stumbles over the following code in lst.h/lst.cpp:

I don't use MSVC. When was that compiler version released,
approximately? (I am of course hoping this is already fixed.)

> lst.h line 35:
> template<> registered_class_info lst::reg_info;
> 
> lst.cpp line 28:
> template <> GINAC_IMPLEMENT_REGISTERED_CLASS_OPT_T(lst, basic,
>   print_func<print_context>(&lst::do_print).
>   print_func<print_tree>(&lst::do_print_tree))
> 
> and says:
> 
> lst.cpp(28): error C2766: explicit specialization; 'reg_info' has
> already been defined
> 
> exprseq.h/.cpp has the same issue.
> 
> A solution seems to be to remove the code in lst.cpp and replace the
> code in lst.h with it. That is
> 
> lst.h:
> template <> GINAC_IMPLEMENT_REGISTERED_CLASS_OPT_T(lst, basic,
>   print_func<print_context>(&lst::do_print).
>   print_func<print_tree>(&lst::do_print_tree))
> 
> This compiles fine and all checks pass, but it does seem wrong to have
> the GINAC_IMPLEMENT_REGISTERED_CLASS_OPT_T in a header file.
> 
> What is the right way to deal with this error?

We discussed this a year ago:
https://www.ginac.de/pipermail/ginac-devel/2021-February/002539.html
Does this shed some light on the issue?

  -richy.



More information about the GiNaC-devel mailing list