[LLVMbugs] [Bug 12775] New: Error recovery can trigger Assertion `isa<LabelDecl>(D) && "declaration not instantiated in this scope"' (SemaTemplateInstantiate.cpp:2563)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed May 9 11:59:36 PDT 2012


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

             Bug #: 12775
           Summary: Error recovery can trigger Assertion
                    `isa<LabelDecl>(D) && "declaration not instantiated in
                    this scope"' (SemaTemplateInstantiate.cpp:2563)
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: hfinkel at anl.gov
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8519
  --> http://llvm.org/bugs/attachment.cgi?id=8519
reduced test case (provided by C.S.)

Running clang trunk on x86-64 on:

 template<typename _CharT> struct char_traits {
      };
        template<typename _Facet> template<typename _CharT, typename _Traits =
char_traits<_CharT> > const _Facet& use_facet(const locale&);
         template<typename _CharT> class collate;
        extern template const collate<char>& use_facet<collate<char> >(const
locale&);

results in:

In file included from prog.cpp:1:
prog.cpp:3:132: error: unknown type name 'locale'
        template<typename _Facet> template<typename _CharT, typename _Traits =
char_traits<_CharT> > const _Facet& use_facet(const locale&);
                                                                               
                                                   ^
prog.cpp:3:9: error: extraneous template parameter list in template
specialization or out-of-line template definition
        template<typename _Facet> template<typename _CharT, typename _Traits =
char_traits<_CharT> > const _Facet& use_facet(const locale&);
        ^~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:3:70: warning: default template arguments for a function template are
a C++11 extension [-Wc++11-extensions]
        template<typename _Facet> template<typename _CharT, typename _Traits =
char_traits<_CharT> > const _Facet& use_facet(const locale&);
                                                                     ^        
~~~~~~~~~~~~~~~~~~~
prog.cpp:5:78: error: unknown type name 'locale'
        extern template const collate<char>& use_facet<collate<char> >(const
locale&);
                                                                             ^
clang:
/nfs2/hfinkel/src/llvm-trunk-writable/tools/clang/lib/Sema/SemaTemplateInstantiate.cpp:2563:
llvm::PointerUnion<clang::Decl*, llvm::SmallVector<clang::Decl*, 4u>*>*
clang::LocalInstantiationScope::findInstantiationOf(const clang::Decl*):
Assertion `isa<LabelDecl>(D) && "declaration not instantiated in this scope"'
failed.

-- 
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