Two missing -Wc++98-compat warnings, for null pointers as non-type template
arguments, and 'this' in exception-specifications.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155606 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index af0f971..7d34507 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -693,6 +693,10 @@
 }
 
 void Sema::CheckCXXThisCapture(SourceLocation Loc, bool Explicit) {
+  if (getLangOpts().CPlusPlus0x &&
+      !dyn_cast_or_null<CXXMethodDecl>(getFunctionLevelDeclContext()))
+    Diag(Loc, diag::warn_cxx98_compat_this_outside_method);
+
   // We don't need to capture this in an unevaluated context.
   if (ExprEvalContexts.back().Context == Unevaluated && !Explicit)
     return;
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index b9ea055..be59068 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -3589,6 +3589,7 @@
   if (ParamType->isPointerType() || ParamType->isNullPtrType()) {
     switch (isNullPointerValueTemplateArgument(S, Param, ParamType, Arg)) {
     case NPV_NullPointer:
+      S.Diag(Arg->getExprLoc(), diag::warn_cxx98_compat_template_arg_null);
       Converted = TemplateArgument((Decl *)0);
       return false;
 
@@ -3885,6 +3886,7 @@
   case NPV_Error:
     return true;
   case NPV_NullPointer:
+    S.Diag(Arg->getExprLoc(), diag::warn_cxx98_compat_template_arg_null);
     Converted = TemplateArgument((Decl *)0);
     return false;
   case NPV_NotNullPointer:
@@ -4320,6 +4322,7 @@
       return ExprError();
       
     case NPV_NullPointer:
+      Diag(Arg->getExprLoc(), diag::warn_cxx98_compat_template_arg_null);
       Converted = TemplateArgument((Decl *)0);
       return Owned(Arg);;
     }