[LLVMbugs] [Bug 21661] New: Clang crashes on valid(?) explicit instantiation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 24 16:00:44 PST 2014


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

            Bug ID: 21661
           Summary: Clang crashes on valid(?) explicit instantiation
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zilla at kayari.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

template<typename T>
struct S
{
  void foo(int) { }
  template<typename U> void foo(U) { }
};

template void S<char>::foo(int);  // XXX

I'm trying to instantiate the non-template, but it crashes clang++, backtrace
below.

I'm not sure if this is actually valid, because I don't see anything in
[temp.explicit] that says how the compiler should determine I mean the
non-template member function of the class template, rather than the member
function template.  G++ says it's ambiguous, but I've reported that as a bug.
EDG compiles the code, but instantiates the member function template, which is
not what I was trying to do.


clang:
/home/jwakely/src/llvm/llvm/tools/clang/lib/Sema/SemaTemplateDeduction.cpp:4488:
clang::UnresolvedSetIterator
clang::Sema::getMostSpecialized(clang::UnresolvedSetIterator,
clang::UnresolvedSetIterator, clang::TemplateSpecCandidateSet &,
clang::SourceLocation, const clang::PartialDiagnostic &, const
clang::PartialDiagnostic &, const clang::PartialDiagnostic &, bool,
clang::QualType): Assertion `BestTemplate && "Not a function template
specialization?"' failed.
0  clang           0x000000000232b738 llvm::sys::PrintStackTrace(_IO_FILE*) +
40
1  clang           0x000000000232ccbb
2  libpthread.so.0 0x000000394a00f6d0
3  libc.so.6       0x0000003949835877 gsignal + 55
4  libc.so.6       0x0000003949836f68 abort + 328
5  libc.so.6       0x000000394982e7d6
6  libc.so.6       0x000000394982e882
7  clang           0x0000000000f2267d
8  clang           0x0000000000edd44b
clang::Sema::ActOnExplicitInstantiation(clang::Scope*, clang::SourceLocation,
clang::SourceLocation, clang::Declarator&) + 5307
9  clang           0x0000000000aa6970
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) + 144
10 clang           0x0000000000b184df
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 3471
11 clang           0x0000000000b16fa4
clang::Parser::ParseExplicitInstantiation(unsigned int, clang::SourceLocation,
clang::SourceLocation, clang::SourceLocation&, clang::AccessSpecifier) + 148
12 clang           0x0000000000b16e68
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 376
13 clang           0x0000000000aa0d6f clang::Parser::ParseDeclaration(unsigned
int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 815
14 clang           0x0000000000a91532
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 1634
15 clang           0x0000000000a90d9d
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 477
16 clang           0x0000000000a8ca86 clang::ParseAST(clang::Sema&, bool, bool)
+ 406
17 clang           0x000000000088f1bc clang::CodeGenAction::ExecuteAction() +
204
18 clang           0x00000000006a1a9e clang::FrontendAction::Execute() + 62
19 clang           0x00000000006746bc
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 892
20 clang           0x000000000065794a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3050
21 clang           0x000000000064e73e cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 526
22 clang           0x0000000000656053 main + 12275
23 libc.so.6       0x0000003949821d65 __libc_start_main + 245
24 clang           0x000000000064e469
Stack dump:
0.      Program arguments: /home/jwakely/src/llvm/3.x/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
inst.cc -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -target-linker-version 2.24
-dwarf-column-info -resource-dir
/home/jwakely/src/llvm/3.x/bin/../lib/clang/3.6.0 -internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../include/c++/4.8.3
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../include/c++/4.8.3/x86_64-redhat-linux
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../include/c++/4.8.3/backward
-internal-isystem /usr/local/include -internal-isystem
/home/jwakely/src/llvm/3.x/bin/../lib/clang/3.6.0/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir /tmp -ferror-limit 19
-fmessage-length 237 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/inst-e7a824.o -x c++ inst.cc 
1.      inst.cc:8:32: current parser token ';'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.6.0 (trunk 222677)
Target: x86_64-unknown-linux-gnu
Thread model: posix

-- 
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/20141125/24f59fab/attachment.html>


More information about the llvm-bugs mailing list