[clang] [clang][Sema] Use original template pattern when declaring implicit deduction guides for nested template classes (PR #68379)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 16 17:48:11 PDT 2023


ilovepi wrote:

I think we may be seeing some issues with this patch, when building Fuchsia.

We're seeing the following error.

```
FAILED: host_x64/obj/sdk/lib/ld/test/ld-unittests.filter-view-tests.cc.o
../../prebuilt/third_party/clang/custom/bin/clang++ -MD -MF host_x64/obj/sdk/lib/ld/test/ld-unittests.filter-view-tests.cc.o.d -DFUCHSIA_API_LEVEL=15 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES -I../.. -Ihost_x64/gen -I../../sdk/lib/ld/include -I../../sdk/lib/stdcompat/include -I../../zircon/system/public -I../../src/lib/elfldltl/include -I../../zircon/system/u...
In file included from ../../sdk/lib/ld/test/filter-view-tests.cc:6:
../../sdk/lib/ld/include/lib/ld/internal/filter-view.h:51:27: error: no member 'filter_iterator' in 'ld::internal::filter_view<std::array<int, 6>, (lambda at ../../sdk/lib/ld/test/filter-view-tests.cc:20:48)>'; it has not yet been instantiated
   51 |     filter_iterator(const filter_iterator&) = default;
      |                           ^
note: while building implicit deduction guide first needed here
../../sdk/lib/ld/test/filter-view-tests.cc:20:31: note: in instantiation of template class 'ld::internal::filter_view<std::array<int, 6>, (lambda at ../../sdk/lib/ld/test/filter-view-tests.cc:20:48)>' requested here
   20 |     ld::internal::filter_view filter_view(arr, [](auto) { return true; });
      |                               ^
../../sdk/lib/ld/include/lib/ld/internal/filter-view.h:40:9: note: not-yet-instantiated member is declared here
   40 |   class filter_iterator : public std::iterator_traits<Iter> {
      |         ^
1 error generated.
```

But the code in question is defining a constructor for the nested class. You can find the code here: https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/lib/ld/include/lib/ld/internal/filter-view.h;l=51?q=filter_iterator&ss=fuchsia%2Ffuchsia

We're tracking this in https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=135353

Do you have any idea why it would be flagging this case. I don't see any obvious C++ rules being violated, so I think this is rather surprising.

I've included a reproducer, but I haven't had a chance to reduce it yet, so it's likely to be quite large.
[filter-view.zip](https://github.com/llvm/llvm-project/files/12923104/filter-view.zip)


https://github.com/llvm/llvm-project/pull/68379


More information about the cfe-commits mailing list