https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79092
Bug ID: 79092
Summary: template<auto>: type ignored if value already
instantiated
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nico at josuttis dot de
Target Milestone: ---
It seems for a template <auto N> the type of N is ignored if the value
already was instantiated.
The essence:
template <auto N>
struct A
{
A() {
std::cout << "A::A(): N is "
<< typeid(N).name() << " with value: " << N << std::endl;
}
};
A<42>();
A<4LL>(); // instantiates A<long long>
A<42LL>(); // instantiates A<int> because we already had A<42>
Full example:
> http://melpon.org/wandbox/permlink/R3Of0JsugjVR6Qmc