[clang] [clang] implement CWG2064: ignore value dependence for decltype (PR #190495)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 6 06:28:56 PDT 2026
================
@@ -194,7 +194,7 @@ class Dependence {
TypeDependence type() const {
return translate(V, UnexpandedPack, TypeDependence::UnexpandedPack) |
translate(V, Instantiation, TypeDependence::Instantiation) |
- translate(V, Dependent, TypeDependence::Dependent) |
+ translate(V, Type, TypeDependence::Dependent) |
----------------
mizvekov wrote:
Yeah, so there is a non-obvious choice here, when "translating" expression dependence to type dependence.
If an expression is part of a type, should value dependence count as type dependence?
Under the post CWG2064 model, this is obviously not the case anymore for `decltype`.
It was not the case for `typeof` as well, but this was handled manually.
I think this change of default to `no` is justified, because for most other types, an expression is already expected to be value dependent. For example, for an array type, if the expression is value dependent, this will be handled through a special type node (DependentArrayType) which is always type dependent anyway.
https://github.com/llvm/llvm-project/pull/190495
More information about the cfe-commits
mailing list