[llvm-bugs] [Bug 39215] Explicit template instantiation can't be combined with specialization

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 8 19:20:34 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=39215

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
                 CC|                            |richard-llvm at metafoo.co.uk
             Status|NEW                         |RESOLVED

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
[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.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181009/58245bfd/attachment.html>


More information about the llvm-bugs mailing list