diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-05-04 22:38:52 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-05-04 22:38:52 +0000 |
commit | ab41fe914f63bb470dfa7e400876ada72f57a931 (patch) | |
tree | e0aa909c06f48478c276804ff8180a4e9f8467f6 /lib/Sema/SemaTemplate.cpp | |
parent | 58822c403cc8855adeecba92248612ee08dc1f3a (diff) |
Move Sema::VerifyIntegerConstantExpression() and
Sema::ConvertToIntegralOrEnumerationType() from PartialDiagnostics to
abstract "diagnoser" classes. Not much of a win here, but we're
-several PartialDiagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156217 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 35d3cfa433..bde80fd5b1 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -4113,8 +4113,20 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param, Diag(Param->getLocation(), diag::note_template_param_here); return ExprError(); } else if (!Arg->isValueDependent()) { - Arg = VerifyIntegerConstantExpression(Arg, &Value, - PDiag(diag::err_template_arg_not_ice) << ArgType, false).take(); + class TmplArgICEDiagnoser : public VerifyICEDiagnoser { + QualType T; + + public: + TmplArgICEDiagnoser(QualType T) : T(T) { } + + virtual void diagnoseNotICE(Sema &S, SourceLocation Loc, + SourceRange SR) { + S.Diag(Loc, diag::err_template_arg_not_ice) << T << SR; + } + } Diagnoser(ArgType); + + Arg = VerifyIntegerConstantExpression(Arg, &Value, Diagnoser, + false).take(); if (!Arg) return ExprError(); } |