Closed Quuxplusone closed 6 years ago
Bugzilla Link | PR39215 |
Status | RESOLVED INVALID |
Importance | P enhancement |
Reported by | Ole Kniemeyer (o_kniemeyer@maxon.de) |
Reported on | 2018-10-08 02:22:08 -0700 |
Last modified on | 2018-10-10 00:55:47 -0700 |
Version | 7.0 |
Hardware | PC MacOS X |
CC | dgregor@apple.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
[temp.spec] (12.8)/5 says:
"For a given template and a given set of template-arguments,
— an explicit instantiation definition shall appear at most once in a program,
— an explicit specialization shall be defined at most once in a program, as specified in 6.2, and
— both an explicit instantiation and a declaration of an explicit specialization shall not appear in a program unless the explicit instantiation follows a declaration of the explicit specialization.
An implementation is not required to diagnose a violation of this rule."
In your case, the explicit instantiation did not follow a declaration of the
explicit specialization, so the program is ill-formed.
(Note that the standard permits an implementation to not diagnose this ill-
formed code, so the fact that GCC and ICC accept this doesn't make them non-
conforming.)
Thanks for the explanation, and sorry for reporting a non-bug.