[all-commits] [llvm/llvm-project] 878a24: Reapply "Fix crash on switch conditions of non-int...

elizabethandrews via All-commits all-commits at lists.llvm.org
Tue Dec 3 15:39:02 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 878a24ee244a24c39d1c57e9af2e88c621f7cce9
      https://github.com/llvm/llvm-project/commit/878a24ee244a24c39d1c57e9af2e88c621f7cce9
  Author: Elizabeth Andrews <elizabeth.andrews at intel.com>
  Date:   2019-12-03 (Tue, 03 Dec 2019)

  Changed paths:
    M clang-tools-extra/test/clang-tidy/checkers/bugprone-string-integer-assignment.cpp
    M clang-tools-extra/test/clang-tidy/checkers/misc-unused-parameters.cpp
    M clang/lib/AST/Expr.cpp
    M clang/lib/Sema/SemaChecking.cpp
    M clang/test/SemaCXX/constant-expression-cxx2a.cpp
    M clang/test/SemaTemplate/dependent-names.cpp
    M clang/test/SemaTemplate/enum-argument.cpp
    M clang/test/SemaTemplate/member-access-expr.cpp
    A clang/test/SemaTemplate/non-integral-switch-cond.cpp

  Log Message:
  -----------
  Reapply "Fix crash on switch conditions of non-integer types in templates"

This patch reapplies commit 759948467ea. Patch was reverted due to a
clang-tidy test fail on Windows. The test has been modified. There
are no additional code changes.

Patch was tested with ninja check-all on Windows and Linux.

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.




More information about the All-commits mailing list