1. Reapply "Fix crash on switch conditions of non-integer types in (details)
Commit 759948467ea3181615d44d80f74ffeb260180fd0 by melanie.blower
Reapply "Fix crash on switch conditions of non-integer types in
This patch reapplies commit 76945821b9cad3. The first version broke
buildbots due to clang-tidy test fails. The fails are because some
errors in templates are now diagnosed earlier (does not wait till
instantiation). I have modified the tests to add checks for these
diagnostics/prevent these diagnostics. There are no additional code
Summary of code changes:
Clang currently crashes for switch statements inside a template when the
condition is a non-integer field member because contextual implicit
conversion is skipped when parsing the condition. This conversion is
however later checked in an assert when the case statement is handled.
The conversion is skipped when parsing the condition because the field
member is set as type-dependent based on its containing class. This
patch sets the type dependency based on the field's type instead.
This patch fixes Bug 40982.
Reviewers: rnk, gribozavr2
Patch by: Elizabeth Andrews (eandrews)
Differential revision:
The file was addedclang/test/SemaTemplate/non-integral-switch-cond.cpp
The file was modifiedclang/test/SemaTemplate/enum-argument.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/misc-unused-parameters.cpp
The file was modifiedclang/lib/Sema/SemaChecking.cpp
The file was modifiedclang/test/SemaCXX/constant-expression-cxx2a.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/bugprone-string-integer-assignment.cpp
The file was modifiedclang/test/SemaTemplate/member-access-expr.cpp
The file was modifiedclang/test/SemaTemplate/dependent-names.cpp
The file was modifiedclang/lib/AST/Expr.cpp