<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/93364>93364</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Unevaluated operand evaluated within requires expression
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Tsche
      </td>
    </tr>
</table>

<pre>
    Consider the following code example:
```cpp
template <typename>
inline constexpr bool dependent_false = false;

struct Universal {
    template <typename T>
    constexpr operator T() { 
 static_assert(dependent_false<T>, "operator T can only be used in unevaluated contexts" ); 
    }
};

static_assert(requires { int{Universal{}}; });
```
https://godbolt.org/z/583rWYG61

GCC and MSVC accept this. Clang errors with 
```
error: static assertion failed due to requirement 'dependent_false<int>': operator T can only be used in unevaluated contexts
    7 |         static_assert(dependent_false<T>, "operator T can only be used in unevaluated contexts" ); 
      | ^~~~~~~~~~~~~~~~~~
<source>:11:30: note: in instantiation of function template specialization 'Universal::operator int<int>' requested here
   11 | static_assert(requires { int{Universal{}}; });
``` 

According to [[expr.prim.req]/2](https://standards.pydong.org/c++/expr.prim.req#general-2) expressions within a requirement-body are unevaluated operands and should therefore not be evaluated ([[expr.context]/1](https://standards.pydong.org/c++/expr.context#1)).

Furthermore
> In an unevaluated operand, a non-static class member can be named ([[expr.prim.id]](https://standards.pydong.org/c++/expr.prim.id)) and naming of objects or functions does not, by itself, require that a definition be provided ([[basic.def.odr]](https://standards.pydong.org/c++/basic.def.odr))

since no definition is required, `Universal::operator int<int>` should not be instantiated.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVk1v4zYQ_TX0ZRBBIm3ZOujg2PGih56abdHTgiJHFguK1JJUPvbQ316Qkr-SHIq0wAqCJZnUzHtv3ozNvVdHg1iT1T1Z7Rd8DJ119aMXHS4aK1_rnTVeSXQQOoTWam2flTmCsBI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