Movatterモバイル変換


[0]ホーム

URL:


This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-12-20


1495. Partial specialization of variadic class template

Section:13.7.6  [temp.spec.partial]    Status:CD3    Submitter:Jason Merrill    Date:2012-04-16

[Moved to DR at the April, 2013 meeting.]

Consider an example like

  template <int B, typename Type1, typename... Types>  struct A;  template<typename... Types>  struct A<0, Types...> { };  A<0,int,int> t;

In this case, the partial specialization seems well-formed by therules in 13.7.6 [temp.spec.partial], but it is not more specializedthan the primary template. However, 13.7.6.2 [temp.spec.partial.match]says that if exactly one matching specialization is found, it is used,which suggests that the testcase is well-formed. That seemsundesirable; I think a partial specialization that is not morespecialized than the primary template should be ill-formed.

If the example is rewritten so that both versions are partialspecializations, i.e.,

  template <int B, typename... Types>  struct A;  template <int B, typename Type1, typename... Types>  struct A<B, Type1, Types...> { }  template<typename... Types>  struct A<0, Types...> { };  A<0,int,int> t;

There is implementation variance, with gcc and clang reporting anambiguity and EDG choosing the second specialization.

Proposed resolution (October, 2012):

Add the following as a new bullet in 13.7.6.1 [temp.spec.partial.general] paragraph 9:




[8]ページ先頭

©2009-2026 Movatter.jp