This patch ensures 'type_uses_auto' also checks for usages of 'auto' in
parameter packs.
PR c++/103497
gcc/cp/ChangeLog:
* pt.cc (type_uses_auto): Check inside parameter packs.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1y/decltype-auto-103497.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
{
if (type == NULL_TREE)
return NULL_TREE;
- else if (flag_concepts_ts)
+
+ /* For parameter packs, check the contents of the pack. */
+ if (PACK_EXPANSION_P (type))
+ type = PACK_EXPANSION_PATTERN (type);
+
+ if (flag_concepts_ts)
{
/* The Concepts TS allows multiple autos in one type-specifier; just
return the first one we find, do_auto_deduction will collect all of
--- /dev/null
+// PR c++/103497
+// { dg-do compile { target c++14 } }
+
+void foo(decltype(auto)... args); // { dg-error "cannot declare a parameter with .decltype.auto.." }
+
+int main() {
+ foo();
+}