flovent wrote:

> but won't this fail with a std::map<int, int>, since the key is an integer?

It won't, `ArraySubScriptExpr` is generated here because variable `map`'s type 
is dependent, it's AST:
```
ArraySubscriptExpr <col:10, col:15> '<dependent type>' lvalue
      -DeclRefExpr <col:10> 'std::map<R *, int>':'map<R *, int>' lvalue ParmVar 
0x227b3b48 'map' 'std::map<R *, int> &'
      -DeclRefExpr <col:14> 'R *' lvalue ParmVar 0x227b3bc8 'r' 'R *'
```
`std::map`'s key is unrelated here, for `std::map<int, int>` a `CallExpr` will 
be generated since it's known that `std::map<int, int>` has a overload operator 
`[]`


https://github.com/llvm/llvm-project/pull/127394
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to