Issue 165734
Summary Qualified name lookup using a type pack is not considered a pack
Labels new issue
Assignees
Reporter MitalAshok
    Consider the following program:

```c++
struct X {
    int i;
};
struct Y {
    int i;
};
struct Z : X, Y {};

void g(int, int);

template<class... Bases, class T>
void f(T z) {
    g(z.Bases::i...);
}

int main() {
    f<X, Y>(Z{});
}
```

Currently Clang complains:

```
<source>:13:17: error: pack expansion does not contain any unexpanded parameter packs
   13 | g(z.Bases::i...);
      |       ~~~~~~~~~~^
```

GCC and MSVC compile this to call `g(0, 0)`.

Clang *does* accept it if `z` is not dependently typed:

```c++
template<class... Bases>
void f(Z z) {
 g(z.Bases::i...);
}
```

[[basic.lookup.qual.general]p3](https://wg21.link/basic.lookup.qual.general#3) is pertinent. It appears there is a situation where an _expression_ is dependently a pack based on a template parameter, so this might be a standard defect.

For example, GCC currently accepts:

```c++
struct X {
    int i;
};
struct Y {
    int i;
};
struct A : X, Y {
    using Bases = void;
};

void g(int, int);

template<class... Bases, class T>
void f(T z) {  // GCC no longer accepts with non-dependent z `template<class... Bases> void f(Z z) {`
    g(z.Bases::i...);
}

int main() {
    f<X, Y>(A{});
}
```

But MSVC doesn't accept this, failing when trying to instantiate `f<X, Y>(A{})`.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to