Bug 90189 - Spurious "error: parameter packs not expanded" when a dependent name coincides
Summary: Spurious "error: parameter packs not expanded" when a dependent name coincides
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
: 100718 114491 116739 (view as bug list)
Depends on:
Blocks: c++-lookup, c++-name-lookup
  Show dependency treegraph
 
Reported: 2019-04-19 18:54 UTC by Leonid Koppel
Modified: 2024-09-17 04:41 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.7.1
Last reconfirmed: 2021-08-27 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leonid Koppel 2019-04-19 18:54:43 UTC
Source:

struct A {
    using CommonName = char;
};

template <typename T, typename... CommonName>
struct B {
    using V = typename T::CommonName;
};

template struct B<A>;


Output:

<source>:7:37: error: parameter packs not expanded with '...':
    7 |     using V = typename T::CommonName;
      |                                     ^
<source>:7:37: note:         'CommonName'
Compiler returned: 1

Rejected by all GCC versions. Accepted by clang, msvc.
Comment 1 Aleksey Covacevice 2020-07-15 20:46:41 UTC
Another such situation:

    template<typename>
    struct any;
    template<typename T>
    using any_t = typename any<T>::type;
    template<typename... type>
    struct str { any_t<any_t<str<type...>>> func(); };

Changing `type` to something else, in either `any_t` or `str`, allows the code to compile.

5.1.0 accepts the code; 5.2.0 onward reject it.

Possibly related to #61022.
Comment 2 Andrew Pinski 2021-08-27 20:31:42 UTC
Confirmed.


https://godbolt.org/z/UuwYK4
Comment 3 Andrew Pinski 2021-08-27 22:57:55 UTC
*** Bug 100718 has been marked as a duplicate of this bug. ***
Comment 4 Andrew Pinski 2024-03-27 00:26:10 UTC
*** Bug 114491 has been marked as a duplicate of this bug. ***
Comment 5 Andrew Pinski 2024-09-17 04:40:26 UTC
*** Bug 116739 has been marked as a duplicate of this bug. ***
Comment 6 Andrew Pinski 2024-09-17 04:41:34 UTC
Another testcase which has the same issue with the clash from PR 116739:
```
template<class> struct l {};

template <class t>
struct mm {
    using type = t;
};

template <class t>
class myclass {
    template <class... type>
    // error: parameter packs not expanded with '...':
    l<typename mm<t>::type> try_push(type&&... k);
};
```