<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - explicit specialization outside of template's namespace inaccuretly accepted"
href="http://llvm.org/bugs/show_bug.cgi?id=19631">19631</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>explicit specialization outside of template's namespace inaccuretly accepted
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.4
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>filip.roseen@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=12464" name="attach_12464" title="testcase.cpp">attachment 12464</a> <a href="attachment.cgi?id=12464&action=edit" title="testcase.cpp">[details]</a></span>
testcase.cpp
namespace N {
template<class>
struct A { };
};
template<>
struct N::A<int> { };
int main () { }
-----------------------------------------------------------
According to `[temp.expl.spec]p2` the above snippet should be rejected, but
`clang` accepts it without any diagnostic (version >3.3).
[temp.expl.spec]p2
> An explicit specialization shall be declared in a namespace
> enclosing the specialized template. An explicit
> specialization whose declarator-id is not qualified shall be
> declared in the nearest enclosing namespace of the template,
> or, if the namespace is inline (7.3.1), any namespace from
> its enclosing namespace set. Such a declaration may also be
> a definition. If the declartion is not a definition, the
> specialization may be defined later (7.3.1.2)
------------------------------------------------------------
[ note: I tried the snippet with version 3.3 of `clang`, and we get a warning
saying that the above is accepted due to `-Wc++11-extensions` (which is
misleading), in later versions of clang no such diagnostic is issued. ]
[ note: `gcc` rejects it, as one should ]</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>