[GiNaC-devel] [SCM] GiNaC -- a C++ library for symbolic computations branch, master, updated. release_1-4-0-708-ga569b474

Alexey Sheplyakov asheplyakov at yandex.ru
Mon Feb 8 11:10:01 CET 2021


Richard,

On 2/3/21 6:59 PM, Richard B. Kreckel wrote:

> Is that patch really correct?
> 
> On 06.01.21 16:45, Richard B. Kreckel via GiNaC-devel wrote:
>> commit c3195f0b5a7ac9fdbfdd04e5f4acf6a836063de0
>> Author: Alexey Sheplyakov <asheplyakov at altlinux.org>
>> Date:   Wed Jan 6 11:20:46 2021 +0400

There's a mistake in the commit message: the section of the standard
which describes the explicit template specialization is 14.7.3.
Everything else looks fine for me.

> I came across it because clang++ now complains:
> 
> lst.cpp:41:37: warning: explicit instantiation of 'info' that occurs
> after an explicit specialization has no effect
> [-Winstantiation-after-specialization]

I don't quite understand the warning. What's the point of the explicit
specialization **after** the thing has been already instantiated (either
explicitly or implicitly)? And having an explicit specialization *after*
the method has been implicitly instantiated is an error. I'll re-read 14.7 ("Template instantiation
and specialization") once more, but for now I think clang++ is wrong, and
we should ignore the warning. I.e. put something like this into lst.cpp:

// ignore bogus "explicit instantiation that occurs after an explicit specialization" warning
#if defined(__clang__) && __has_warning("-Winstantiation-after-specialization")
#pragma clang diagnostic ignored "-Winstantiation-after-specialization"
#endif

> Wouldn't it be sufficent to include "lst.h" in "integration_kernel.cpp"?

I think it's implementation defined. The definition of lst::info() is available
in lst.cpp only, and nothing in that translation unit uses lst::info().
Therefore the compiler is not obliged to instantiate lst::info() (although it's
OK to do so). gcc and clang seem to instantiate it, but msvc needs the explicit
instantiation (or something which triggers the implicit instantiation, like
`dummy_func` in exprseq.cpp)

Best regards,
     Alexey


More information about the GiNaC-devel mailing list