<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Crash on missing 'get' with structured binding"
href="https://bugs.llvm.org/show_bug.cgi?id=41800">41800</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Crash on missing 'get' with structured binding
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++'17
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dblaikie@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>This might also be a crash-on-valid (or at least crash-on-VS standard library
(may or may not be valid)).
creduce got me this:
struct d {
int x, y;
};
// template<size_t> int get(d);
namespace std {
template <size_t, class>
struct tuple_element {
using type = int;
};
template <class>
struct tuple_size;
template<>
struct tuple_size<d> {
static constexpr size_t value = 2;
};
}
d j();
template <int>
struct i {
static void k() {
auto [x, y] = j();
}
};
void fn1() {
i <8>
::k();
}
Crashes:
clang::VarDecl::checkInitIsICE() const tools/clang/lib/AST/Decl.cpp:0:3
checkTupleLikeDecomposition(clang::Sema&, llvm::ArrayRef<clang::BindingDecl*>,
clang::VarDecl*, clang::QualType, llvm::APSInt const&)
tools/clang/lib/Sema/SemaDeclCXX.cpp:1210:12
clang::Sema::CheckCompleteDecompositionDeclaration(clang::DecompositionDecl*)
tools/clang/lib/Sema/SemaDeclCXX.cpp:1432:9
clang::Sema::CheckCompleteVariableDeclaration(clang::VarDecl*)
tools/clang/lib/Sema/SemaDecl.cpp:11933:19
clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool)
tools/clang/lib/Sema/SemaDecl.cpp:11451:1
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
tools/clang/lib/Parse/ParseDecl.cpp:2325:5
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
tools/clang/lib/Parse/ParseDecl.cpp:2059:9
clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, bool,
clang::Parser::ForRangeInit*) tools/clang/lib/Parse/ParseDecl.cpp:1784:10
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&)
tools/clang/lib/Parse/ParseDecl.cpp:1724:12
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
tools/clang/lib/Parse/ParseStmt.cpp:213:29
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
tools/clang/lib/Parse/ParseStmt.cpp:106:20
clang::Parser::ParseCompoundStatementBody(bool)
tools/clang/lib/Parse/ParseStmt.cpp:1057:11
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) tools/clang/lib/Parse/ParseStmt.cpp:2070:21
clang::Parser::ParseLateTemplatedFuncDef(clang::LateParsedTemplate&)
tools/clang/lib/Parse/ParseTemplate.cpp:1462:7
clang::Parser::LateTemplateParserCallback(void*, clang::LateParsedTemplate&)
tools/clang/lib/Parse/ParseTemplate.cpp:1372:1
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool, bool)
tools/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4146:15
clang::Sema::PerformPendingInstantiations(bool)
tools/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:5485:13
clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind)
tools/clang/lib/Sema/Sema.cpp:908:3
clang::Sema::ActOnEndOfTranslationUnit() tools/clang/lib/Sema/Sema.cpp:932:5
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
tools/clang/lib/Parse/Parser.cpp:650:5
clang::ParseAST(clang::Sema&, bool, bool)
tools/clang/lib/Parse/ParseAST.cpp:158:16
clang::ASTFrontendAction::ExecuteAction()
tools/clang/lib/Frontend/FrontendAction.cpp:1037:1
clang::CodeGenAction::ExecuteAction()
tools/clang/lib/CodeGen/CodeGenAction.cpp:1057:1
clang::FrontendAction::Execute()
tools/clang/lib/Frontend/FrontendAction.cpp:938:7
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
tools/clang/lib/Frontend/CompilerInstance.cpp:945:7
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:273:8
cc1_main(llvm::ArrayRef<char const*>, char const*, void*)
tools/clang/tools/driver/cc1_main.cpp:225:13
ExecuteCC1Tool(llvm::ArrayRef<char const*>, llvm::StringRef)
tools/clang/tools/driver/driver.cpp:309:5
main tools/clang/tools/driver/driver.cpp:381:5
It's possible that the original example (
<a href="https://gist.github.com/degski/3949d4bc2b723c659fae29cb4eabc47e">https://gist.github.com/degski/3949d4bc2b723c659fae29cb4eabc47e</a> ) crashes on
/valid/, but I can't tell for sure that VS stdlib's 'get' for std::pair is
valid - fixing the crash on invalid might reveal a better error message for the
std::pair situation. And it'd be pretty unfortunate if the VS standard library
had invalid code - might be worth/necessary to workaround it? Not sure.
But it's certainly related to structured bindings in the original - turning off
the two uses of structured bindings (both over std::pair) removes the crash.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>