diff options
Diffstat (limited to 'include/clang/Sema/TemplateDeduction.h')
-rw-r--r-- | include/clang/Sema/TemplateDeduction.h | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/include/clang/Sema/TemplateDeduction.h b/include/clang/Sema/TemplateDeduction.h index ed1e768832cc..f4a706ecb9ab 100644 --- a/include/clang/Sema/TemplateDeduction.h +++ b/include/clang/Sema/TemplateDeduction.h @@ -40,6 +40,9 @@ class TemplateDeductionInfo { /// \brief Have we suppressed an error during deduction? bool HasSFINAEDiagnostic; + /// \brief The template parameter depth for which we're performing deduction. + unsigned DeducedDepth; + /// \brief Warnings (and follow-on notes) that were suppressed due to /// SFINAE while performing template argument deduction. SmallVector<PartialDiagnosticAt, 4> SuppressedDiagnostics; @@ -48,9 +51,9 @@ class TemplateDeductionInfo { void operator=(const TemplateDeductionInfo &) = delete; public: - TemplateDeductionInfo(SourceLocation Loc) + TemplateDeductionInfo(SourceLocation Loc, unsigned DeducedDepth = 0) : Deduced(nullptr), Loc(Loc), HasSFINAEDiagnostic(false), - Expression(nullptr) {} + DeducedDepth(DeducedDepth), Expression(nullptr) {} /// \brief Returns the location at which template argument is /// occurring. @@ -58,6 +61,12 @@ public: return Loc; } + /// \brief The depth of template parameters for which deduction is being + /// performed. + unsigned getDeducedDepth() const { + return DeducedDepth; + } + /// \brief Take ownership of the deduced template argument list. TemplateArgumentList *take() { TemplateArgumentList *Result = Deduced; @@ -70,6 +79,11 @@ public: assert(HasSFINAEDiagnostic); PD.first = SuppressedDiagnostics.front().first; PD.second.swap(SuppressedDiagnostics.front().second); + clearSFINAEDiagnostic(); + } + + /// \brief Discard any SFINAE diagnostics. + void clearSFINAEDiagnostic() { SuppressedDiagnostics.clear(); HasSFINAEDiagnostic = false; } @@ -199,10 +213,7 @@ struct DeductionFailureInfo { void *Data; /// \brief A diagnostic indicating why deduction failed. - union { - void *Align; - char Diagnostic[sizeof(PartialDiagnosticAt)]; - }; + alignas(PartialDiagnosticAt) char Diagnostic[sizeof(PartialDiagnosticAt)]; /// \brief Retrieve the diagnostic which caused this deduction failure, /// if any. |