[all-commits] [llvm/llvm-project] 95abf8: [ADT] Work around MSVC bug affecting `get(enumerat...

Jakub Kuderski via All-commits all-commits at lists.llvm.org
Mon Mar 27 07:36:24 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 95abf86060ec7de63f59290e5fb2902839293938
  Author: Jakub Kuderski <kubak at google.com>
  Date:   2023-03-27 (Mon, 27 Mar 2023)

  Changed paths:
    M llvm/include/llvm/ADT/STLExtras.h

  Log Message:
  [ADT] Work around MSVC bug affecting `get(enumerator_result)`

This happened on a small number of MSVC releases (19.31.31xxx, Visual Studio 2022 17.1.x), and worked fine on everything else.

The issue seemed to be related to return type deduction on a function with and `if constexpr`; the compiler got confused and deduced different function return type from the type of the return statement.

The workaround is to split `get` into two functions using `enable_if`.

Reviewed By: dstuttard

Differential Revision: https://reviews.llvm.org/D146893

More information about the All-commits mailing list