[PATCH] D61522: Added an assertion to constant evaluation enty points that prohibits dependent expressions

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 9 07:23:37 PDT 2019


gribozavr marked an inline comment as done.
gribozavr added inline comments.


================
Comment at: clang/lib/Sema/SemaOverload.cpp:6369
     // very difficult. Ideally, we should handle them more gracefully.
-    if (!EIA->getCond()->EvaluateWithSubstitution(
+    if (EIA->getCond()->isValueDependent() ||
+        !EIA->getCond()->EvaluateWithSubstitution(
----------------
rsmith wrote:
> This is treating value-dependent `enable_if` conditions as having failed. Is that really appropriate? (When do we call this with value-depnedent `enable_if` attributes? I'd expect it to only be called after substitution)
This test case in `llvm-project/clang/test/SemaCXX/enable_if.cpp` passes a dependent condition:

```
void h(int);
template <typename T> void outer() {
  void local_function() __attribute__((enable_if(::h(T()), "")));
  local_function();
};
```

According to https://reviews.llvm.org/D20130, it seems like it was decided to document implementation details as specification, and say that `enable_if` is evaluated during overload resolution, whenever that happens to happen.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61522/new/

https://reviews.llvm.org/D61522





More information about the cfe-commits mailing list