[llvm-bugs] [Bug 45740] New: Valid Template Instantiation triggers assertion failure when Clang/LLVM built with ASSERTs enabled, but does not fail without assertion
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Apr 29 09:41:24 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45740
Bug ID: 45740
Summary: Valid Template Instantiation triggers assertion
failure when Clang/LLVM built with ASSERTs enabled,
but does not fail without assertion
Product: clang
Version: 10.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++17
Assignee: unassignedclangbugs at nondot.org
Reporter: nicholas at untether.ai
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
When Clang and LLVM (version 10.0.0 for both) are compiled from source with
'Release' build and assertions are enabled, the following code:
template <const int& x>
void g() {
x;
}
template <int>
void f() {
static constexpr int x = 0;
g<x>();
}
int main() {
f<0>();
return 0;
}
will error out with:
clang++ -std=c++17 template.cpp
OR
clang++ -std=c++2a template.cpp
producing:
clang-10:
/xxxxx/llvm-project-llvmorg-10.0.0/clang/lib/Sema/SemaTemplateInstantiate.cpp:3527:
llvm::PointerUnion<clang::Decl*, llvm::SmallVector<clang::VarDecl*, 4>*>*
clang::LocalInstantiationScope::findInstantiationOf(const clang::Decl*):
Assertion `isa<LabelDecl>(D) && "declaration not instantiated in this scope"'
failed.
However, if Clang and LLVM are compiled for RELEASE and assertions are turned
off, the code snippet passes through.
This also affects Clang and LLVM (trunk).
--
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/20200429/32eb3b35/attachment.html>
More information about the llvm-bugs
mailing list