[LLVMbugs] [Bug 12780] New: Error recovery can trigger Assertion `TemplateTypeParm->getDepth() == 0 && "Can't deduce with depth > 0"'

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed May 9 12:31:54 PDT 2012


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

             Bug #: 12780
           Summary: Error recovery can trigger Assertion
                    `TemplateTypeParm->getDepth() == 0 && "Can't deduce
                    with depth > 0"'
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          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 8523
  --> http://llvm.org/bugs/attachment.cgi?id=8523
reduced test case (provided by C.S.)

Running clang trunk on:

 template<class _CharT> struct char_traits : public
__gnu_cxx::char_traits<_CharT> {
  };
       template<typename _CharT, typename _Traits = char_traits<_CharT> > class
basic_ostream;
      typedef basic_ostream<char> ostream;
            template<class _Traits> template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>& flush(basic_ostream<_CharT, _Traits>&
__os) {
  }
    extern template ostream& flush(ostream&);

results in:

In file included from prog.cpp:1:
prog.cpp:1:53: error: use of undeclared identifier '__gnu_cxx'
 template<class _CharT> struct char_traits : public
__gnu_cxx::char_traits<_CharT> {
                                                    ^
prog.cpp:5:72: error: declaration of '_Traits' shadows template parameter
  ...template<class _Traits> template<typename _CharT, typename _Traits> inline
basic_ostream<_CharT, _Traits>& flush(basic_ostream<_CharT,...
                                                                ^
prog.cpp:5:28: note: template parameter is declared here
            template<class _Traits> template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&...
                           ^
prog.cpp:5:110: error: reference to '_Traits' is ambiguous
  ...template<typename _CharT, typename _Traits> inline basic_ostream<_CharT,
_Traits>& flush(basic_ostream<_CharT, _Traits>& __os) {
                                                                              ^
prog.cpp:5:72: note: candidate found by name lookup is '_Traits'
  ...template<class _Traits> template<typename _CharT, typename _Traits> inline
basic_ostream<_CharT, _Traits>& flush(basic_ostream<_CharT,...
                                                                ^
prog.cpp:5:28: note: candidate found by name lookup is '_Traits'
            template<class _Traits> template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&...
                           ^
prog.cpp:5:148: error: reference to '_Traits' is ambiguous
  ...template<typename _CharT, typename _Traits> inline basic_ostream<_CharT,
_Traits>& flush(basic_ostream<_CharT, _Traits>& __os) {
                                                                               
                                    ^
prog.cpp:5:72: note: candidate found by name lookup is '_Traits'
  ...template<class _Traits> template<typename _CharT, typename _Traits> inline
basic_ostream<_CharT, _Traits>& flush(basic_ostream<_CharT,...
                                                                ^
prog.cpp:5:28: note: candidate found by name lookup is '_Traits'
            template<class _Traits> template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&...
                           ^
prog.cpp:5:13: error: extraneous template parameter list in template
specialization or out-of-line template definition
            template<class _Traits> template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&...
            ^~~~~~~~~~~~~~~~~~~~~~~
clang:
/src/llvm-trunk-writable/tools/clang/lib/Sema/SemaTemplateDeduction.cpp:1002:
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.

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