[LLVMbugs] [Bug 19631] New: explicit specialization outside of template's namespace inaccuretly accepted
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri May 2 00:07:04 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=19631
Bug ID: 19631
Summary: explicit specialization outside of template's
namespace inaccuretly accepted
Product: clang
Version: 3.4
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: filip.roseen at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 12464
--> http://llvm.org/bugs/attachment.cgi?id=12464&action=edit
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 ]
--
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/20140502/9c10e59c/attachment.html>
More information about the llvm-bugs
mailing list