[PATCH] D50418: [Sema] Support for P0961R1: Relaxing the structured bindings customization point finding rules

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 7 16:48:49 PDT 2018


rsmith added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:1118-1130
+    //   ... and if that finds at least one declaration that is a function
+    //   template whose first template parameter is a non-type parameter ...
+    LookupResult::Filter Filter = MemberGet.makeFilter();
+    while (Filter.hasNext()) {
+      NamedDecl *ND = Filter.next();
+      if (auto *FTD = dyn_cast<FunctionTemplateDecl>(ND)) {
+        TemplateParameterList *TPL = FTD->getTemplateParameters();
----------------
This should be done by walking the lookup results, not by filtering them. Testcase:

```
struct A {
  int get();
};
struct B {
  template<int> int get();
};
struct C : A, B {};
// plus specializations of tuple_size<C> and tuple_element<N, C>
auto [x] = C();
```

This should be ill-formed due to ambiguity when looking up `C::get`. We should not resolve the ambiguity by selecting `B::get`.


Repository:
  rC Clang

https://reviews.llvm.org/D50418





More information about the cfe-commits mailing list