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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs