Reputation: 60999
When explicitly specializing both tuple_size
and tuple_element
for some template, I realized that §14.5.1/4, which reads
In a redeclaration, partial specialization, explicit specialization or explicit instantiation of a class template, the class-key shall agree in kind with the original class template declaration (7.1.6.3).
is seemingly violated by the standard itself:
Am I missing something here (e.g. the standard specifies that class-keys are "exposition only" and shall agree within the actual implementation)?
Upvotes: 4
Views: 142
Reputation: 137315
Bo Persson's now-deleted answer got it right. The paragraph ([temp.class]/p4) you cite refers to §7.1.6.3 [dcl.type.elab] for the definition of "agree in kind", which in turn says (p3, emphasis mine)
The class-key or
enum
keyword present in the elaborated-type-specifier shall agree in kind with the declaration to which the name in the elaborated-type-specifier refers. This rule also applies to the form of elaborated-type-specifier that declares a class-name or friend class since it can be construed as referring to the definition of the class. Thus, in any elaborated-type-specifier, theenum
keyword shall be used to refer to an enumeration (7.2), theunion
class-key shall be used to refer to a union (Clause 9), and either theclass
orstruct
class-key shall be used to refer to a class (Clause 9) declared using theclass
orstruct
class-key.
The code is valid, if inconsistent.
Upvotes: 4
Reputation: 218860
This looks like an editorial defect to me. Try opening an issue here:
https://github.com/cplusplus/draft/issues
If you're adventurous, try resolving it with a pull request. :-)
Upvotes: 1