[LLVMbugs] [Bug 13365] New: valgrind error emitting template diagnostic

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jul 15 02:50:58 PDT 2012


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

             Bug #: 13365
           Summary: valgrind error emitting template diagnostic
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


This testcase is reduced from delta:

template <class T> class ResultTy {
  T t;
};

template <class T1, class T2>
  typename ResultTy<T2>::error Deduce( void (T1::*member)(T2) ) {}

struct Cls {
  void method(int&);
};
void test() {
  Deduce(&Cls::method);
}

$ valgrind clang -cc1 -x c++-cpp-output 269.c

269.c:1:26: warning: class 'ResultTy<int &>' does not declare any constructor
to initialize its non-modifiable members
template <class T> class ResultTy {
                         ^
269.c:6:12: note: in instantiation of template class 'ResultTy<int &>'
requested here
  typename ResultTy<T2>::error Deduce( void (T1::*member)(T2) ) {}
           ^
==25044== Conditional jump or move depends on uninitialised value(s)
==25044==    at 0x1AF478D: clang::TemplateArgument::print(clang::PrintingPolicy
const&, llvm::raw_ostream&) const (TemplateBase.cpp:336)
==25044==    by 0x125AA02:
clang::Sema::getTemplateArgumentBindingsText(clang::TemplateParameterList
const*, clang::TemplateArgument const*, unsigned int) (SemaTemplate.cpp:7305)
==25044==    by 0x12DB674: clang::Sema::PrintInstantiationStack()
(SemaTemplateInstantiate.cpp:551)
==25044==    by 0xFA0374: clang::Sema::EmitCurrentDiagnostic(unsigned int)
(Sema.cpp:884)
==25044==    by 0xFA3581:
clang::Sema::SemaDiagnosticBuilder::~SemaDiagnosticBuilder() (Sema.h:796)
==25044==    by 0x107C8E2:
clang::Sema::CheckCompletedCXXClass(clang::CXXRecordDecl*)
(SemaDeclCXX.cpp:3786)
==25044==    by 0x12E0943: clang::Sema::InstantiateClass(clang::SourceLocation,
clang::CXXRecordDecl*, clang::CXXRecordDecl*,
clang::MultiLevelTemplateArgumentList const&,
clang::TemplateSpecializationKind, bool) (SemaTemplateInstantiate.cpp:1953)
==25044==    by 0x12E188E:
clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation,
clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind,
bool) (SemaTemplateInstantiate.cpp:2268)
==25044==    by 0x1352E1B:
clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType,
clang::Sema::TypeDiagnoser&) (SemaType.cpp:4240)
==25044==    by 0xFBFD30: bool
clang::Sema::RequireCompleteType<clang::SourceRange>(clang::SourceLocation,
clang::QualType, unsigned int, clang::SourceRange const&) (Sema.h:1021)
==25044==    by 0xFBC125:
clang::Sema::RequireCompleteDeclContext(clang::CXXScopeSpec&,
clang::DeclContext*) (SemaCXXScopeSpec.cpp:230)
==25044==    by 0x1259CD1:
clang::Sema::CheckTypenameType(clang::ElaboratedTypeKeyword,
clang::SourceLocation, clang::NestedNameSpecifierLoc, clang::IdentifierInfo
const&, clang::SourceLocation) (SemaTemplate.cpp:7049)
==25044== 
==25044== Use of uninitialised value of size 8
==25044==    at 0x1AF47A0: clang::TemplateArgument::print(clang::PrintingPolicy
const&, llvm::raw_ostream&) const (TemplateBase.cpp:336)
==25044==    by 0x125AA02:
clang::Sema::getTemplateArgumentBindingsText(clang::TemplateParameterList
const*, clang::TemplateArgument const*, unsigned int) (SemaTemplate.cpp:7305)
==25044==    by 0x12DB674: clang::Sema::PrintInstantiationStack()
(SemaTemplateInstantiate.cpp:551)
==25044==    by 0xFA0374: clang::Sema::EmitCurrentDiagnostic(unsigned int)
(Sema.cpp:884)
==25044==    by 0xFA3581:
clang::Sema::SemaDiagnosticBuilder::~SemaDiagnosticBuilder() (Sema.h:796)
==25044==    by 0x107C8E2:
clang::Sema::CheckCompletedCXXClass(clang::CXXRecordDecl*)
(SemaDeclCXX.cpp:3786)
==25044==    by 0x12E0943: clang::Sema::InstantiateClass(clang::SourceLocation,
clang::CXXRecordDecl*, clang::CXXRecordDecl*,
clang::MultiLevelTemplateArgumentList const&,
clang::TemplateSpecializationKind, bool) (SemaTemplateInstantiate.cpp:1953)
==25044==    by 0x12E188E:
clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation,
clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind,
bool) (SemaTemplateInstantiate.cpp:2268)
==25044==    by 0x1352E1B:
clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType,
clang::Sema::TypeDiagnoser&) (SemaType.cpp:4240)
==25044==    by 0xFBFD30: bool
clang::Sema::RequireCompleteType<clang::SourceRange>(clang::SourceLocation,
clang::QualType, unsigned int, clang::SourceRange const&) (Sema.h:1021)
==25044==    by 0xFBC125:
clang::Sema::RequireCompleteDeclContext(clang::CXXScopeSpec&,
clang::DeclContext*) (SemaCXXScopeSpec.cpp:230)
==25044==    by 0x1259CD1:
clang::Sema::CheckTypenameType(clang::ElaboratedTypeKeyword,
clang::SourceLocation, clang::NestedNameSpecifierLoc, clang::IdentifierInfo
const&, clang::SourceLocation) (SemaTemplate.cpp:7049)
==25044== 
269.c:6:32: note: while substituting deduced template arguments into function
template 'Deduce' [with T1 = Cls, T2 = <no value>]
  typename ResultTy<T2>::error Deduce( void (T1::*member)(T2) ) {}
                               ^
269.c:2:5: note: reference member 't' will never be initialized
  T t;
    ^
269.c:12:3: error: no matching function for call to 'Deduce'
  Deduce(&Cls::method);
  ^~~~~~
269.c:6:32: note: candidate template ignored: substitution failure [with T1 =
Cls, T2 = int &]: no type named 'error' in 'ResultTy<int &>'
  typename ResultTy<T2>::error Deduce( void (T1::*member)(T2) ) {}
                         ~~~~~ ^
1 warning and 1 error generated.

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