[LLVMbugs] [Bug 9401] New: Regression concerning nested name specifier

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 4 01:46:53 PST 2011


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

           Summary: Regression concerning nested name specifier
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: abramobagnara at tin.it
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The following source (from gcc testsuite) used to compile correctly, but it
crashes with r126952.

$ cat typedef35.C
// Origin c++/45558
// { dg-do compile }

template <typename S, typename T>
struct C
{
  template <typename U>
  struct B
  {
    template <typename W>
    struct E
    {
      explicit E(const W &x) : w(x) {}
      const W &w;
    };
  };
};

struct F;
template <typename X>
struct D
{
  D() {}
};

const D<F> g;
template <typename S, typename T>
struct A
{
  template <typename U>
  struct B : C<S, T>::template B<U>
  {
    typedef typename C<S, T>::template B<U> V;
    static const D<typename V::template E<D<F> > > a;
  };
};

template <typename S, typename T>
template <typename U>
const D<typename C<S, T>::template B<U>::template E<D<F> > >
A<S, T>::B<U>::a = typename C<S, T>::template B<U>::template E<D<F> >(g);


$ clang++ -c typedef35.C
clang:
/space/home/abagnara/llvm/tools/clang/lib/Serialization/../../include/clang/AST/TypeLoc.h:1544:
void
clang::DependentTemplateSpecializationTypeLoc::setQualifierLoc(clang::NestedNameSpecifierLoc):
Assertion `QualifierLoc.getNestedNameSpecifier() ==
getTypePtr()->getQualifier() && "Inconsistent nested-name-specifier pointer"'
failed.
0  clang           0x0000000002103e25
1  clang           0x0000000002103c18
2  libpthread.so.0 0x00007f78ec4238f0
3  libc.so.6       0x00007f78eb712a75 gsignal + 53
4  libc.so.6       0x00007f78eb7165c0 abort + 384
5  libc.so.6       0x00007f78eb70b941 __assert_fail + 241
6  clang           0x000000000103d034
clang::DependentTemplateSpecializationTypeLoc::setQualifierLoc(clang::NestedNameSpecifierLoc)
+ 172
7  clang           0x000000000144cccf
8  clang           0x00000000014403a8
9  clang           0x00000000014350d1
10 clang           0x0000000001446f00
11 clang           0x000000000143718c
12 clang           0x0000000001433eef
13 clang           0x00000000014619ff
14 clang           0x000000000145a461
15 clang           0x000000000144c768
16 clang           0x00000000014467e6
17 clang           0x00000000014370b4
18 clang           0x0000000001433eef
19 clang           0x0000000001432df9
clang::Sema::RebuildTypeInCurrentInstantiation(clang::TypeSourceInfo*,
clang::SourceLocation, clang::DeclarationName) + 141
20 clang           0x00000000012ef0e6
21 clang           0x00000000012ef8f9
clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&,
clang::ASTMultiPtr<clang::TemplateParameterList*>, bool) + 1661
22 clang           0x000000000142d72e
clang::Sema::ActOnTemplateDeclarator(clang::Scope*,
clang::ASTMultiPtr<clang::TemplateParameterList*>, clang::Declarator&) + 80
23 clang           0x0000000001251627
clang::Parser::ParseDeclarationAfterDeclarator(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&) + 467
24 clang           0x0000000001279420
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&,
clang::Parser::ParsingDeclRAIIObject&, clang::SourceLocation&,
clang::AccessSpecifier) + 756
25 clang           0x00000000012790de
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier) + 996
26 clang           0x0000000001278c63
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier) + 175
27 clang           0x0000000001250adf
clang::Parser::ParseDeclaration(clang::ASTOwningVector<clang::Stmt*, 32u>&,
unsigned int, clang::SourceLocation&,
clang::Parser::ParsedAttributesWithRange&) + 185
28 clang           0x0000000001249e9f
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 1225
29 clang           0x0000000001249946
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 210
30 clang           0x0000000001232051 clang::ParseAST(clang::Sema&, bool) + 328
31 clang           0x0000000000f898a5 clang::ASTFrontendAction::ExecuteAction()
+ 263
32 clang           0x00000000010d6253 clang::CodeGenAction::ExecuteAction() +
947
33 clang           0x0000000000f894f6 clang::FrontendAction::Execute() + 320
34 clang           0x0000000000f71cc1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 751
35 clang           0x0000000000f1b3ea
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 912
36 clang           0x0000000000f0d5c7 cc1_main(char const**, char const**, char
const*, void*) + 982
37 clang           0x0000000000f16940 main + 499
38 libc.so.6       0x00007f78eb6fdc4d __libc_start_main + 253
39 clang           0x0000000000f0cc69
Stack dump:
0.    Program arguments: /space/home/abagnara/llvm/Debug+Asserts/bin/clang -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name typedef35.C -mrelocation-model static -mdisable-fp-elim
-masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64
-target-linker-version 2.20.1 -momit-leaf-frame-pointer -resource-dir
/space/home/abagnara/llvm/Debug+Asserts/bin/../lib/clang/2.9 -ferror-limit 19
-fmessage-length 80 -fcxx-exceptions -fexceptions -fgnu-runtime
-fdiagnostics-show-option -fcolor-diagnostics -o typedef35.o -x c++ typedef35.C 
1.    typedef35.C:41:18: current parser token '='
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal 1 (use -v to see
invocation)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list