[GiNaC-devel] Another MSVC error
Jan Rheinländer
jrheinlaender at gmx.de
Wed Feb 16 21:24:10 CET 2022
Hi Richard,
> Can you, please, try to explicitly delete the default ctors instead?
> Find a patch attached.
the patch leads to
lst.h(35): error C2280:
'GiNaC::class_info<GiNaC::registered_class_options>::class_info(void)':
attempting to reference a deleted function
class_info.h(48): note: see declaration of
'GiNaC::class_info<GiNaC::registered_class_options>::class_info'
class_info.h(48): note:
'GiNaC::class_info<GiNaC::registered_class_options>::class_info(void)':
function was explicitly deleted
exprseq.h(35): error C2280:
'GiNaC::class_info<GiNaC::registered_class_options>::class_info(void)':
attempting to reference a deleted function
class_info.h(48): note: see declaration of
'GiNaC::class_info<GiNaC::registered_class_options>::class_info'
class_info.h(48): note:
'GiNaC::class_info<GiNaC::registered_class_options>::class_info(void)':
function was explicitly deleted
But since these two lines are exactly those two which we need to #ifdef
away because of the C2766 error, both errors can be resolved by a simple
patch:
diff --git a/ginac/exprseq.h b/ginac/exprseq.h
index dea1e38e..61a2527d 100644
--- a/ginac/exprseq.h
+++ b/ginac/exprseq.h
@@ -32,7 +32,10 @@namespace GiNaC {
typedef container<std::vector> exprseq;
/** Declaration of container::reg_info for exprseq. */
+#ifndef _MSC_VER
+// Avoid exprseq.cpp(27): error C2766: explicit specialization;
'reg_info' has already been defined
template<> registered_class_info exprseq::reg_info;
+#endif
// defined in exprseq.cpp
template<> bool exprseq::info(unsigned inf) const;
diff --git a/ginac/lst.h b/ginac/lst.h
index 6b047c69..415abd03 100644
--- a/ginac/lst.h
+++ b/ginac/lst.h
@@ -32,7 +32,10 @@namespace GiNaC {
typedef container<std::list> lst;
/** Declaration of container::reg_info for lst. */
+#ifndef _MSC_VER
+// Avoid lst.cpp(28): error C2766: explicit specialization; 'reg_info'
has already been defined
template<> registered_class_info lst::reg_info;
+#endif
/** Specialization of container::get_default_flags() for lst. */
template<> inline unsigned lst::get_default_flags() { return
status_flags::not_shareable; }
This compiles and all checks pass.
By the way, both declaration and definition in lst.h/cpp and
exprseq.h/cpp seem to be superfluous, since even without them all tests
also pass successfully...
Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ginac.de/pipermail/ginac-devel/attachments/20220216/18adc970/attachment.htm>
More information about the GiNaC-devel
mailing list