@@ -353,6 +353,72 @@ class PreferredTypeBuilder {
353
353
llvm::function_ref<QualType()> ComputeType;
354
354
};
355
355
356
+ /// Describes the result of template argument deduction.
357
+ ///
358
+ /// The TemplateDeductionResult enumeration describes the result of
359
+ /// template argument deduction, as returned from
360
+ /// DeduceTemplateArguments(). The separate TemplateDeductionInfo
361
+ /// structure provides additional information about the results of
362
+ /// template argument deduction, e.g., the deduced template argument
363
+ /// list (if successful) or the specific template parameters or
364
+ /// deduced arguments that were involved in the failure.
365
+ enum class TemplateDeductionResult {
366
+ /// Template argument deduction was successful.
367
+ Success = 0,
368
+ /// The declaration was invalid; do nothing.
369
+ Invalid,
370
+ /// Template argument deduction exceeded the maximum template
371
+ /// instantiation depth (which has already been diagnosed).
372
+ InstantiationDepth,
373
+ /// Template argument deduction did not deduce a value
374
+ /// for every template parameter.
375
+ Incomplete,
376
+ /// Template argument deduction did not deduce a value for every
377
+ /// expansion of an expanded template parameter pack.
378
+ IncompletePack,
379
+ /// Template argument deduction produced inconsistent
380
+ /// deduced values for the given template parameter.
381
+ Inconsistent,
382
+ /// Template argument deduction failed due to inconsistent
383
+ /// cv-qualifiers on a template parameter type that would
384
+ /// otherwise be deduced, e.g., we tried to deduce T in "const T"
385
+ /// but were given a non-const "X".
386
+ Underqualified,
387
+ /// Substitution of the deduced template argument values
388
+ /// resulted in an error.
389
+ SubstitutionFailure,
390
+ /// After substituting deduced template arguments, a dependent
391
+ /// parameter type did not match the corresponding argument.
392
+ DeducedMismatch,
393
+ /// After substituting deduced template arguments, an element of
394
+ /// a dependent parameter type did not match the corresponding element
395
+ /// of the corresponding argument (when deducing from an initializer list).
396
+ DeducedMismatchNested,
397
+ /// A non-depnedent component of the parameter did not match the
398
+ /// corresponding component of the argument.
399
+ NonDeducedMismatch,
400
+ /// When performing template argument deduction for a function
401
+ /// template, there were too many call arguments.
402
+ TooManyArguments,
403
+ /// When performing template argument deduction for a function
404
+ /// template, there were too few call arguments.
405
+ TooFewArguments,
406
+ /// The explicitly-specified template arguments were not valid
407
+ /// template arguments for the given template.
408
+ InvalidExplicitArguments,
409
+ /// Checking non-dependent argument conversions failed.
410
+ NonDependentConversionFailure,
411
+ /// The deduced arguments did not satisfy the constraints associated
412
+ /// with the template.
413
+ ConstraintsNotSatisfied,
414
+ /// Deduction failed; that's all we know.
415
+ MiscellaneousDeductionFailure,
416
+ /// CUDA Target attributes do not match.
417
+ CUDATargetMismatch,
418
+ /// Some error which was already diagnosed.
419
+ AlreadyDiagnosed
420
+ };
421
+
356
422
/// Sema - This implements semantic analysis and AST building for C.
357
423
class Sema final {
358
424
Sema(const Sema &) = delete;
@@ -9261,72 +9327,6 @@ class Sema final {
9261
9327
QualType adjustCCAndNoReturn(QualType ArgFunctionType, QualType FunctionType,
9262
9328
bool AdjustExceptionSpec = false);
9263
9329
9264
- /// Describes the result of template argument deduction.
9265
- ///
9266
- /// The TemplateDeductionResult enumeration describes the result of
9267
- /// template argument deduction, as returned from
9268
- /// DeduceTemplateArguments(). The separate TemplateDeductionInfo
9269
- /// structure provides additional information about the results of
9270
- /// template argument deduction, e.g., the deduced template argument
9271
- /// list (if successful) or the specific template parameters or
9272
- /// deduced arguments that were involved in the failure.
9273
- enum TemplateDeductionResult {
9274
- /// Template argument deduction was successful.
9275
- TDK_Success = 0,
9276
- /// The declaration was invalid; do nothing.
9277
- TDK_Invalid,
9278
- /// Template argument deduction exceeded the maximum template
9279
- /// instantiation depth (which has already been diagnosed).
9280
- TDK_InstantiationDepth,
9281
- /// Template argument deduction did not deduce a value
9282
- /// for every template parameter.
9283
- TDK_Incomplete,
9284
- /// Template argument deduction did not deduce a value for every
9285
- /// expansion of an expanded template parameter pack.
9286
- TDK_IncompletePack,
9287
- /// Template argument deduction produced inconsistent
9288
- /// deduced values for the given template parameter.
9289
- TDK_Inconsistent,
9290
- /// Template argument deduction failed due to inconsistent
9291
- /// cv-qualifiers on a template parameter type that would
9292
- /// otherwise be deduced, e.g., we tried to deduce T in "const T"
9293
- /// but were given a non-const "X".
9294
- TDK_Underqualified,
9295
- /// Substitution of the deduced template argument values
9296
- /// resulted in an error.
9297
- TDK_SubstitutionFailure,
9298
- /// After substituting deduced template arguments, a dependent
9299
- /// parameter type did not match the corresponding argument.
9300
- TDK_DeducedMismatch,
9301
- /// After substituting deduced template arguments, an element of
9302
- /// a dependent parameter type did not match the corresponding element
9303
- /// of the corresponding argument (when deducing from an initializer list).
9304
- TDK_DeducedMismatchNested,
9305
- /// A non-depnedent component of the parameter did not match the
9306
- /// corresponding component of the argument.
9307
- TDK_NonDeducedMismatch,
9308
- /// When performing template argument deduction for a function
9309
- /// template, there were too many call arguments.
9310
- TDK_TooManyArguments,
9311
- /// When performing template argument deduction for a function
9312
- /// template, there were too few call arguments.
9313
- TDK_TooFewArguments,
9314
- /// The explicitly-specified template arguments were not valid
9315
- /// template arguments for the given template.
9316
- TDK_InvalidExplicitArguments,
9317
- /// Checking non-dependent argument conversions failed.
9318
- TDK_NonDependentConversionFailure,
9319
- /// The deduced arguments did not satisfy the constraints associated
9320
- /// with the template.
9321
- TDK_ConstraintsNotSatisfied,
9322
- /// Deduction failed; that's all we know.
9323
- TDK_MiscellaneousDeductionFailure,
9324
- /// CUDA Target attributes do not match.
9325
- TDK_CUDATargetMismatch,
9326
- /// Some error which was already diagnosed.
9327
- TDK_AlreadyDiagnosed
9328
- };
9329
-
9330
9330
TemplateDeductionResult
9331
9331
DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial,
9332
9332
ArrayRef<TemplateArgument> TemplateArgs,
@@ -14444,7 +14444,7 @@ class Sema final {
14444
14444
};
14445
14445
14446
14446
DeductionFailureInfo
14447
- MakeDeductionFailureInfo(ASTContext &Context, Sema:: TemplateDeductionResult TDK,
14447
+ MakeDeductionFailureInfo(ASTContext &Context, TemplateDeductionResult TDK,
14448
14448
sema::TemplateDeductionInfo &Info);
14449
14449
14450
14450
/// Contains a late templated function.
0 commit comments