[GiNaC-devel] Another MSVC error

Richard B. Kreckel kreckel at in.terlu.de
Wed Feb 16 23:50:56 CET 2022


Hi Jan!

On 16.02.22 21:24, Jan Rheinländer wrote:
> 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

Well, this confirms it: MSVC indeed tries to instantiate a
registered_class_info at lst.h:35 and at exprseq.h:35.

But the standard says in [temp.expl.spec] §13:
An explicit specialization of a static data member of a template or an
explicit specialization of a static  data member template is a
definition if the declaration includes an initializer; otherwise, it is
a declaration. [Note: The definition of a static data member of a
template that requires default-initialization must use a braced-init-list:
    template<> X Q<int>::x;     // declaration
    template<> X Q<int>::x ();  // error: declares a function
    template<> X Q<int>::x { }; // definition
--end note]

There is no initializer at lst.h:35 and at exprseq.h:35. Hence, this is
merely a declaration and the compiler's error message is wrong.

Moreover, since you have shown that the program works when a default
ctor is provided, we can conclude that the constructed objects are never
used, since class_info is not a plain old data type (it contains three
pointers) - otherwise the program should crash.

Sigh, I am going to apply this patch with a grudge. Thank you, Jan, for
reporting this and for trying out the various patches!

> 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...

Oh, try compiling without them using CLang! We discussed this a year ago
when patch f271f67d2f was pushed. The discussion can be found on the
list archive.

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



More information about the GiNaC-devel mailing list