[GiNaC-devel] MSVC error 2766

Jan Rheinländer jrheinlaender at gmx.de
Mon Feb 14 20:31:59 CET 2022


Hi Richard,

that was MSVC from Visual Studio 2019. But the same happens with
19.30.30706 from VS 2022. Also, past experience shows that MSVC is very
strict (you might say pedantic) about the standard. So I have little
hope that the problem will go away with a new version of MSVC. The help
page for error 2766
<https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-2/compiler-error-c2766?view=msvc-170>
says "Duplicate explicit specializations are not allowed". Though
looking at the thread
<https://www.ginac.de/pipermail/ginac-devel/2021-February/002539.html>
you cited it would seem that the code in the header should be viewed as
a declaration, not a definition:

/>> According to 14.7.3.13 />>/"An explicit specialization of a static data member of a template is />>/a definition if the declaration includes an initializer; otherwise, />>/it's a declaration."/

On the other hand, looking at structure.h, it does assign a value to
reg_info in the header file. So maybe the solution I suggested (move
GINAC_IMPLEMENT_REGISTERED_CLASS_OPT_T to the header) is not that bad
after all?

structure.h line 242:

template <class T, template <class> class CP>
registered_class_info structure<T, CP>::reg_info =
registered_class_info(registered_class_options(structure::get_class_name(),
"basic", typeid(structure<T, CP>)));

Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ginac.de/pipermail/ginac-devel/attachments/20220214/3a8dd249/attachment.htm>


More information about the GiNaC-devel mailing list