[llvm-bugs] [Bug 51767] New: Unclear error message
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Sep 6 06:20:57 PDT 2021
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: unassignedclangbugs at nondot.org
Reporter: jvapen at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210906/7863cc9c/attachment.html>
More information about the llvm-bugs
mailing list