<html>
<head>
<base href="http://llvm.org/bugs/" />
</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 --- - Clang crashes when instantiating a function template which uses decltype"
href="http://llvm.org/bugs/show_bug.cgi?id=18744">18744</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang crashes when instantiating a function template which uses decltype
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.4
</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>release blocker
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>be.gentner@googlemail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Clang crashes when instantiating a function template which uses decltype as the
return type and inside the function a decltype typedef. The error only appears
when you compile with PCH (precompiled header).
Stackdump:
0 libLLVM-3.3.so 0x0000003920951672 llvm::sys::PrintStackTrace(_IO_FILE*) +
50
1 libLLVM-3.3.so 0x00000039209514a4
2 libpthread.so.0 0x00000039c860f750
3 clang 0x00000000010fd16c
4 clang 0x00000000010fd2c2
5 clang 0x000000000062a973
6 clang 0x00000000010feb60
7 clang 0x00000000010ffcb2
clang::Stmt::Profile(llvm::FoldingSetNodeID&, clang::ASTContext const&, bool)
const + 2962
8 clang 0x0000000000ff1974
clang::ASTContext::getDecltypeType(clang::Expr*, clang::QualType) const + 100
9 clang 0x00000000007308a8 clang::ASTReader::readTypeRecord(unsigned
int) + 4728
10 clang 0x00000000007313bd clang::ASTReader::GetType(unsigned int) +
141
11 clang 0x0000000000731983
clang::ASTReader::getLocalType(clang::serialization::ModuleFile&, unsigned int)
+ 19
12 clang 0x000000000074d337
13 clang 0x000000000072fc23 clang::ASTReader::readTypeRecord(unsigned
int) + 1523
14 clang 0x00000000007313bd clang::ASTReader::GetType(unsigned int) +
141
15 clang 0x0000000000731983
clang::ASTReader::getLocalType(clang::serialization::ModuleFile&, unsigned int)
+ 19
16 clang 0x000000000075d53b
clang::ASTDeclReader::VisitValueDecl(clang::ValueDecl*) + 75
17 clang 0x000000000075d67f
clang::ASTDeclReader::VisitDeclaratorDecl(clang::DeclaratorDecl*) + 15
18 clang 0x000000000075dbc0
clang::ASTDeclReader::VisitFunctionDecl(clang::FunctionDecl*) + 192
19 clang 0x000000000076415d clang::ASTDeclReader::Visit(clang::Decl*)
+ 445
20 clang 0x0000000000764b44 clang::ASTReader::ReadDeclRecord(unsigned
int) + 1044
21 clang 0x0000000000726207 clang::ASTReader::GetDecl(unsigned int) +
231
22 clang 0x000000000075b134
clang::ASTDeclReader::VisitDecl(clang::Decl*) + 100
23 clang 0x000000000075b7a1
clang::ASTDeclReader::VisitNamedDecl(clang::NamedDecl*) + 17
24 clang 0x000000000075d501
clang::ASTDeclReader::VisitValueDecl(clang::ValueDecl*) + 17
25 clang 0x000000000075d67f
clang::ASTDeclReader::VisitDeclaratorDecl(clang::DeclaratorDecl*) + 15
26 clang 0x000000000075ef66
clang::ASTDeclReader::VisitVarDecl(clang::VarDecl*) + 182
27 clang 0x000000000075f37f
clang::ASTDeclReader::VisitParmVarDecl(clang::ParmVarDecl*) + 15
28 clang 0x00000000007640bd clang::ASTDeclReader::Visit(clang::Decl*)
+ 285
29 clang 0x0000000000764b44 clang::ASTReader::ReadDeclRecord(unsigned
int) + 1044
30 clang 0x0000000000726207 clang::ASTReader::GetDecl(unsigned int) +
231
31 clang 0x00000000007765a4
clang::ASTStmtReader::VisitDeclRefExpr(clang::DeclRefExpr*) + 356
32 clang 0x000000000077888b
clang::ASTReader::ReadStmtFromStream(clang::serialization::ModuleFile&) + 2875
33 clang 0x0000000000730899 clang::ASTReader::readTypeRecord(unsigned
int) + 4713
34 clang 0x00000000007313bd clang::ASTReader::GetType(unsigned int) +
141
35 clang 0x0000000000731983
clang::ASTReader::getLocalType(clang::serialization::ModuleFile&, unsigned int)
+ 19
36 clang 0x000000000074d337
37 clang 0x0000000000730c33 clang::ASTReader::readTypeRecord(unsigned
int) + 5635
38 clang 0x00000000007313bd clang::ASTReader::GetType(unsigned int) +
141
39 clang 0x0000000000764040 clang::ASTDeclReader::Visit(clang::Decl*)
+ 160
40 clang 0x0000000000764b44 clang::ASTReader::ReadDeclRecord(unsigned
int) + 1044
41 clang 0x0000000000726207 clang::ASTReader::GetDecl(unsigned int) +
231
42 clang 0x0000000000730c1f clang::ASTReader::readTypeRecord(unsigned
int) + 5615
43 clang 0x00000000007313bd clang::ASTReader::GetType(unsigned int) +
141
44 clang 0x0000000000731983
clang::ASTReader::getLocalType(clang::serialization::ModuleFile&, unsigned int)
+ 19
45 clang 0x000000000074d337
46 clang 0x000000000072fd6e clang::ASTReader::readTypeRecord(unsigned
int) + 1854
47 clang 0x00000000007313bd clang::ASTReader::GetType(unsigned int) +
141
48 clang 0x0000000000731983
clang::ASTReader::getLocalType(clang::serialization::ModuleFile&, unsigned int)
+ 19
49 clang 0x000000000074d337
50 clang 0x000000000073226d
clang::ASTReader::GetTypeSourceInfo(clang::serialization::ModuleFile&,
llvm::SmallVector<unsigned long, 64u> const&, unsigned int&) + 45
51 clang 0x0000000000752879
clang::ASTDeclReader::ReadCXXDefinitionData(clang::CXXRecordDecl::DefinitionData&,
llvm::SmallVector<unsigned long, 64u> const&, unsigned int&) + 1641
52 clang 0x000000000075c49e
clang::ASTDeclReader::VisitCXXRecordDecl(clang::CXXRecordDecl*) + 174
53 clang 0x000000000076422d clang::ASTDeclReader::Visit(clang::Decl*)
+ 653
54 clang 0x0000000000764b44 clang::ASTReader::ReadDeclRecord(unsigned
int) + 1044
55 clang 0x0000000000726207 clang::ASTReader::GetDecl(unsigned int) +
231
56 clang 0x0000000000730fce clang::ASTReader::readTypeRecord(unsigned
int) + 6558
57 clang 0x00000000007313bd clang::ASTReader::GetType(unsigned int) +
141
58 clang 0x0000000000731983
clang::ASTReader::getLocalType(clang::serialization::ModuleFile&, unsigned int)
+ 19
59 clang 0x000000000076d0fb
clang::ASTStmtReader::VisitExpr(clang::Expr*) + 75
60 clang 0x00000000007746f9
clang::ASTStmtReader::VisitLambdaExpr(clang::LambdaExpr*) + 25
61 clang 0x000000000077888b
clang::ASTReader::ReadStmtFromStream(clang::serialization::ModuleFile&) + 2875
62 clang 0x000000000072cefb
clang::ASTReader::GetExternalDeclStmt(unsigned long) + 107
63 clang 0x00000000010508d6
clang::FunctionDecl::getBody(clang::FunctionDecl const*&) const + 118
64 clang 0x0000000000c76da8
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 184
65 clang 0x0000000000c76ada
clang::Sema::PerformPendingInstantiations(bool) + 490
66 clang 0x00000000009bfa9a clang::Sema::ActOnEndOfTranslationUnit()
+ 3194
67 clang 0x000000000092fc76
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 486
68 clang 0x0000000000927deb clang::ParseAST(clang::Sema&, bool, bool)
+ 571
69 clang 0x00000000007c8da2 clang::CodeGenAction::ExecuteAction() +
50
70 clang 0x000000000066bdf9 clang::FrontendAction::Execute() + 169
71 clang 0x000000000064bc65
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 309
72 clang 0x000000000063538c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1724
73 clang 0x000000000062ea10 cc1_main(char const**, char const**, char
const*, void*) + 1072
74 clang 0x000000000062d041 main + 7841
75 libc.so.6 0x00000039c7e21d65 __libc_start_main + 245
76 clang 0x000000000062d915
Clang invocation:
/usr/bin/clang -cc1 -triple x86_64-redhat-linux-gnu -emit-obj -mrelax-all
-disable-free -disable-llvm-verifier -main-file-name CCampaignHandler.cpp
-mrelocation-model pic -pic-level 2 -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -target-linker-version 2.23.2 -g -D
""M_BIN_DIR=\"/usr/local/bin\""" -D ""M_DATA_DIR=\"/usr/local/share/vcmi\""" -D
""M_LIB_DIR=\"/usr/local/lib64/vcmi\""" -D "vcmi_EXPORTS" -Wall -Wextra
-Wpointer-arith -Wno-switch -Wno-sign-compare -Wno-unused-parameter
-Wuninitialized -Wno-overloaded-virtual -Wno-mismatched-tags -std=c++0x
-fdeprecated-macro -ferror-limit 19 -fmessage-length 0 -mstackrealign
-fobjc-runtime=gcc -fobjc-default-synthesize-properties -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -backend-option -vectorize-loops -x c++
CCampaignHandler-DqmNlF.cpp
Template function:
//Returns iterator to the element for which the value of ValueFunction is
maximal
template<class ForwardRange, class ValueFunction>
auto maxElementByFun(const ForwardRange& rng, ValueFunction vf) ->
decltype(std::begin(rng))
{
typedef decltype(*std::begin(rng)) ElemType;
return boost::max_element(rng, [&] (ElemType lhs, ElemType rhs) -> bool
{
return vf(lhs) < vf(rhs);
});
}
If no ElemType typedef is used, Clang doesn't 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>