[LLVMbugs] [Bug 19169] New: crash on invalid attempting to specialize a template method as a template variable

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 17 20:39:29 PDT 2014


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

            Bug ID: 19169
           Summary: crash on invalid attempting to specialize a template
                    method as a template variable
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++1y
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Testcase:

template <typename T> int* f();
template <typename T> void f();
template<> int f<double>;

nlewycky at ducttape:~$ llvm/Debug+Asserts/bin/clang c.cc
c.cc:3:16: warning: variable templates are a C++1y extension
      [-Wc++1y-extensions]
template<> int f<double>;
               ^
clang: /usr/local/google/home/nlewycky/llvm/include/llvm/Support/Casting.h:95:
static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To =
clang::VarTemplateDecl; From = clang::TemplateDecl]: Assertion `Val && "isa<>
used on a null pointer"' failed.
0  clang           0x000000000377cc8a llvm::sys::PrintStackTrace(_IO_FILE*) +
38
1  clang           0x000000000377cf07
2  clang           0x000000000377c8a1
3  libpthread.so.0 0x00007fd1f1c7fcb0
4  libc.so.6       0x00007fd1f0fb7425 gsignal + 53
5  libc.so.6       0x00007fd1f0fbab8b abort + 379
6  libc.so.6       0x00007fd1f0fb00ee
7  libc.so.6       0x00007fd1f0fb0192
8  clang           0x00000000014bd681
9  clang           0x00000000014bd574
10 clang           0x00000000014bd30e
11 clang           0x00000000014bcde2
12 clang           0x00000000018108a8
13 clang           0x00000000017fa310
clang::Sema::ActOnVarTemplateSpecialization(clang::Scope*, clang::Declarator&,
clang::TypeSourceInfo*, clang::SourceLocation, clang::TemplateParameterList*,
clang::StorageClass, bool) + 350
14 clang           0x000000000154255f
clang::Sema::ActOnVariableDeclarator(clang::Scope*, clang::Declarator&,
clang::DeclContext*, clang::TypeSourceInfo*, clang::LookupResult&,
llvm::MutableArrayRef<clang::TemplateParameterList*>, bool&) + 4319
15 clang           0x000000000153f87e
clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&,
llvm::MutableArrayRef<clang::TemplateParameterList*>) + 2882
16 clang           0x0000000001808f4d
clang::Sema::ActOnTemplateDeclarator(clang::Scope*,
llvm::MutableArrayRef<clang::TemplateParameterList*>, clang::Declarator&) + 59
17 clang           0x000000000140787b
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&) + 239
18 clang           0x000000000140773b
clang::Parser::ParseDeclarationAfterDeclarator(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&) + 73
19 clang           0x0000000001461dcd
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 2051
20 clang           0x000000000146157c
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 972
21 clang           0x0000000001461197
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 209
22 clang           0x0000000001406288
clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned
int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 242
23 clang           0x00000000013f4930
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 1724
24 clang           0x00000000013f422a
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 538
25 clang           0x00000000013ed738 clang::ParseAST(clang::Sema&, bool, bool)
+ 609
26 clang           0x0000000000f4c6a0 clang::ASTFrontendAction::ExecuteAction()
+ 322
27 clang           0x00000000011d381c clang::CodeGenAction::ExecuteAction() +
1224
28 clang           0x0000000000f4c1d3 clang::FrontendAction::Execute() + 205
29 clang           0x0000000000f1c674
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 720
30 clang           0x0000000000ee4627
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1077
31 clang           0x0000000000ed3a73 cc1_main(char const**, char const**, char
const*, void*) + 636
32 clang           0x0000000000edfe7f main + 770
33 libc.so.6       0x00007fd1f0fa276d __libc_start_main + 237
34 clang           0x0000000000ed2139
Stack dump:
0.      Program arguments:
/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
c.cc -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.23.52.20130808 -resource-dir
/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/../lib/clang/3.5.0
-internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/backward
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/x86_64-linux-gnu/c++/4.6
-internal-isystem /usr/local/include -internal-isystem
/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/../lib/clang/3.5.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir /usr/local/google/home/nlewycky
-ferror-limit 19 -fmessage-length 80 -mstackrealign -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-slp -o /tmp/c-5cebb2.o -x c++ c.cc 
1.      c.cc:3:25: 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.5.0 (trunk 204082) (llvm/trunk 204081)
Target: x86_64-unknown-linux-gnu

-- 
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/20140318/2b990f41/attachment.html>


More information about the llvm-bugs mailing list