From: Douglas Gregor Date: Wed, 25 Feb 2009 19:48:02 +0000 (+0000) Subject: Include the appropriate header for malloc X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac1afdc58e6ad5c969f45fd2ff6d140d3b4dd862;p=clang Include the appropriate header for malloc git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65471 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Lex/Token.h b/include/clang/Lex/Token.h index 5bbb63add9..2c8f2ad3f2 100644 --- a/include/clang/Lex/Token.h +++ b/include/clang/Lex/Token.h @@ -17,6 +17,7 @@ #include "clang/Basic/TemplateKinds.h" #include "clang/Basic/TokenKinds.h" #include "clang/Basic/SourceLocation.h" +#include namespace clang { @@ -295,10 +296,10 @@ struct TemplateIdAnnotation { static TemplateIdAnnotation* Allocate(unsigned NumArgs) { TemplateIdAnnotation *TemplateId - = (TemplateIdAnnotation *)malloc(sizeof(TemplateIdAnnotation) + - sizeof(void*) * NumArgs + - sizeof(SourceLocation) * NumArgs + - sizeof(bool) * NumArgs); + = (TemplateIdAnnotation *)std::malloc(sizeof(TemplateIdAnnotation) + + sizeof(void*) * NumArgs + + sizeof(SourceLocation) * NumArgs + + sizeof(bool) * NumArgs); TemplateId->NumArgs = NumArgs; return TemplateId; } diff --git a/test/SemaTemplate/class-template-spec.cpp b/test/SemaTemplate/class-template-spec.cpp index 86cd52c3e3..4de220a77c 100644 --- a/test/SemaTemplate/class-template-spec.cpp +++ b/test/SemaTemplate/class-template-spec.cpp @@ -41,4 +41,5 @@ void testme(X *x1, X *x2) { x2->bar(); // okay: refers to #2 } -// FIXME: diagnose specializations in a different namespace +// Diagnose specializations in a different namespace +class A { };