https://bugs.llvm.org/show_bug.cgi?id=51767
Bug ID: 51767
Summary: Unclear error message
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
Reproduction: https://compiler-explorer.com/z/T3Yx33j3v
t.cpp
=====
// clang++ -std=c++20 t.cpp
namespace NS {
template <typename T> class C {};
} // namespace NS
namespace NS::Sub {
template class NS::C<int>;
}
result:
=======
<source>:6:20: error: explicit instantiation of 'C' not in a namespace
enclosing 'NS'
template class NS::C<int>;
^
<source>:2:29: note: explicit instantiation refers here
template <typename T> class C {};
^
1 error generated.
Expected:
=========
In our code, this got triggered via some macro's and the explicit instantiation
happened in a different file than the template. Given some layers of
indirection, this isn't that obvious to people not familiar with the specifics.
Expected message should include the namespace the compiler does deduce for the
instantiation, for example:
explicit instantiation of 'C' happens in namespace 'NS::Sub::NS' while only
allowed in namespace 'NS'
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs