[LLVMbugs] [Bug 20764] New: Assertion `TemplateTypeParm->getDeptAsserts on valid with (non-dependent) call to conversion function template in template definition contexth() == 0 && "Can't deduce with depth > 0"' failed.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Aug 26 21:42:13 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20764

            Bug ID: 20764
           Summary: Assertion `TemplateTypeParm->getDeptAsserts on valid
                    with (non-dependent) call to conversion function
                    template in template definition contexth() == 0 &&
                    "Can't deduce with depth > 0"' failed.
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hstong at ca.ibm.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Asserts on valid with (non-dependent) call to conversion function template in
template definition context.

### SOURCE:
$ cat callTmplConvOpInTmplClass.cc 
template <typename U> struct A {
   template <typename T> operator T();
   void f();
};

template <typename U>
void A<U>::f() {
   0, operator int();
}


### COMPILER INVOCATION AND OUTPUT:
$ clang -cc1 -x c++ -std=c++03 callTmplConvOpInTmplClass.cc 
clang:
/build/clang/src/llvm/tools/clang/lib/Sema/SemaTemplateDeduction.cpp:1129:
clang::Sema::TemplateDeductionResult
DeduceTemplateArgumentsByTypeMatch(clang::Sema&, clang::TemplateParameterList*,
clang::QualType, clang::QualType, clang::sema::TemplateDeductionInfo&,
llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int, bool,
llvm::SmallVectorImpl<RefParamPartialOrderingComparison>*): Assertion
`TemplateTypeParm->getDepth() == 0 && "Can't deduce with depth > 0"' failed.
0  clang           0x0000000003c87265 llvm::sys::PrintStackTrace(_IO_FILE*) +
38
1  clang           0x0000000003c874e2
2  clang           0x0000000003c86e88
3  libpthread.so.0 0x00007f53462af340
4  libc.so.6       0x00007f53454ebf79 gsignal + 57
5  libc.so.6       0x00007f53454ef388 abort + 328
6  libc.so.6       0x00007f53454e4e36
7  libc.so.6       0x00007f53454e4ee2
8  clang           0x0000000001ab59a6
9  clang           0x0000000001ab6ca7
10 clang           0x0000000001abe483
clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*,
clang::TemplateArgumentListInfo*, clang::QualType, clang::FunctionDecl*&,
clang::sema::TemplateDeductionInfo&, bool) + 831
11 clang           0x00000000019860eb
12 clang           0x000000000198855f
clang::Sema::LookupQualifiedName(clang::LookupResult&, clang::DeclContext*,
bool) + 317
13 clang           0x0000000001986df2
clang::Sema::CppLookupName(clang::LookupResult&, clang::Scope*) + 2010
14 clang           0x0000000001987e26
clang::Sema::LookupName(clang::LookupResult&, clang::Scope*, bool) + 1266
15 clang           0x0000000001988e51
clang::Sema::LookupParsedName(clang::LookupResult&, clang::Scope*,
clang::CXXScopeSpec*, bool, bool) + 355
16 clang           0x000000000187b397
clang::Sema::ActOnIdExpression(clang::Scope*, clang::CXXScopeSpec&,
clang::SourceLocation, clang::UnqualifiedId&, bool, bool,
clang::CorrectionCandidateCallback*, bool) + 1037
17 clang           0x000000000163c4e3 clang::Parser::ParseCXXIdExpression(bool)
+ 347
18 clang           0x000000000163345f clang::Parser::ParseCastExpression(bool,
bool, bool&, clang::Parser::TypeCastState) + 7147
19 clang           0x000000000163176e clang::Parser::ParseCastExpression(bool,
bool, clang::Parser::TypeCastState) + 54
20 clang           0x0000000001630873
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 171
21 clang           0x0000000001631064
clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*,
true>, clang::prec::Level) + 1624
22 clang           0x00000000016306b6
clang::Parser::ParseExpression(clang::Parser::TypeCastState) + 60
23 clang           0x0000000001663b33 clang::Parser::ParseExprStatement() + 69
24 clang           0x00000000016633e7
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 1007
25 clang           0x0000000001662ca4
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 128
26 clang           0x0000000001665a2b
clang::Parser::ParseCompoundStatementBody(bool) + 1065
27 clang           0x0000000001668db2
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 322
28 clang           0x00000000015fb7e9
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
3253
29 clang           0x000000000166ff35
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 2227
30 clang           0x000000000166f61e
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 1026
31 clang           0x000000000166f203
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 209
32 clang           0x000000000160b3e0
clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned
int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 218
33 clang           0x00000000015f9de6
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 1828
34 clang           0x00000000015f9678
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 538
35 clang           0x00000000015f2eea clang::ParseAST(clang::Sema&, bool, bool)
+ 602
36 clang           0x00000000010af8c4 clang::ASTFrontendAction::ExecuteAction()
+ 322
37 clang           0x00000000010af39f clang::FrontendAction::Execute() + 139
38 clang           0x00000000010799bd
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 721
39 clang           0x000000000103d1eb
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 993
40 clang           0x000000000102ad32 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 770
41 clang           0x0000000001037cbc
42 clang           0x00000000010380f0 main + 661
43 libc.so.6       0x00007f53454d6ec5 __libc_start_main + 245
44 clang           0x0000000001029369
Stack dump:
0.    Program arguments: clang -cc1 -x c++ -std=c++03
callTmplConvOpInTmplClass.cc 
1.    callTmplConvOpInTmplClass.cc:8:19: current parser token '('
2.    callTmplConvOpInTmplClass.cc:7:16: parsing function body 'f'
3.    callTmplConvOpInTmplClass.cc:7:16: in compound statement ('{}')
Aborted (core dumped)


### COMPILER VERSION INFO:
$ clang++ -v
clang version 3.6.0 (trunk 215824)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Selected multilib: .;@m64

-- 
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/20140827/49b694d8/attachment.html>


More information about the llvm-bugs mailing list