extern tree make_constrained_decltype_auto (tree, tree);
extern tree make_template_placeholder (tree);
extern tree make_cast_auto (void);
+extern tree make_auto_pack (void);
extern bool template_placeholder_p (tree);
extern bool ctad_template_p (tree);
extern bool unparenthesized_id_or_class_member_access_p (tree);
if (explicit_init_p)
{
- tree auto_node = make_auto ();
-
- type = auto_node;
- if (by_reference_p)
- /* Add the reference now, so deduction doesn't lose
- outermost CV qualifiers of EXPR. */
- type = build_reference_type (type);
if (uses_parameter_packs (expr))
- /* Stick with 'auto' even if the type could be deduced. */
- TEMPLATE_TYPE_PARAMETER_PACK (auto_node) = true;
+ {
+ /* Stick with 'auto...' even if the type could be deduced. */
+ type = make_auto_pack ();
+ if (by_reference_p)
+ type = build_reference_type (type);
+ }
else
- type = do_auto_deduction (type, expr, auto_node);
+ {
+ tree auto_node = make_auto ();
+ type = auto_node;
+ if (by_reference_p)
+ /* Add the reference now, so deduction doesn't lose
+ outermost CV qualifiers of EXPR. */
+ type = build_reference_type (type);
+ type = do_auto_deduction (type, expr, auto_node);
+ }
}
else if (!type_deducible_expression_p (expr))
{
return make_constrained_placeholder_type (type, con, args);
}
+/* Create an "auto..." type-specifier. */
+
+tree
+make_auto_pack ()
+{
+ tree type = make_auto_1 (auto_identifier, false);
+ TEMPLATE_TYPE_PARAMETER_PACK (type) = true;
+ /* Our canonical type depends on being a pack. */
+ TYPE_CANONICAL (type) = canonical_type_parameter (type);
+ return type;
+}
+
/* Returns true if the placeholder type constraint T has any dependent
(explicit) template arguments. */
--- /dev/null
+// PR c++/122015
+
+template <typename> auto declval();
+template <typename... _BindArgs> void bind_front() {
+ [... __bound_args(_BindArgs{})] {};
+}
--- /dev/null
+// PR c++/122015
+// { dg-do compile { target c++20 } }
+// { dg-additional-options "-fmodule-header" }
+// { dg-module-cmi {} }
+
+#include "lambda-11.h"
--- /dev/null
+// PR c++/122015
+// { dg-do compile { target c++20 } }
+// { dg-additional-options "-fmodules -fno-module-lazy" }
+
+#include "lambda-11.h"
+import "lambda-11_a.H";