#define DECL_CONV_FN_TYPE(FN) \
TREE_TYPE ((gcc_checking_assert (DECL_CONV_FN_P (FN)), DECL_NAME (FN)))
-/* Nonzero if NODE, a static data member, was declared in its class as an
+/* Nonzero if NODE, a templated variable, was declared as an
array of unknown bound. */
#define VAR_HAD_UNKNOWN_BOUND(NODE) \
(DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE)) \
DECL_TI_TEMPLATE (fndecl) = tmpl;
DECL_TI_ARGS (fndecl) = targ_ptr;
if (VAR_P (pattern))
- /* Now that we we've formed this variable template specialization,
- remember the result of most_specialized_partial_spec for it. */
- TI_PARTIAL_INFO (DECL_TEMPLATE_INFO (fndecl)) = partial_ti;
+ {
+ /* Now that we we've formed this variable template specialization,
+ remember the result of most_specialized_partial_spec for it. */
+ TI_PARTIAL_INFO (DECL_TEMPLATE_INFO (fndecl)) = partial_ti;
+
+ /* And remember if the variable was declared with []. */
+ if (TREE_CODE (TREE_TYPE (fndecl)) == ARRAY_TYPE
+ && TYPE_DOMAIN (TREE_TYPE (fndecl)) == NULL_TREE)
+ SET_VAR_HAD_UNKNOWN_BOUND (fndecl);
+ }
fndecl = register_specialization (fndecl, gen_tmpl, targ_ptr, false, hash);
if (fndecl == error_mark_node)
--- /dev/null
+// PR c++/113638
+// { dg-do compile { target c++14 } }
+
+template<int ...Is>
+constexpr int my_array[]{Is...};
+constexpr auto t1 = my_array<2>;
+static_assert(sizeof(my_array<1>) == sizeof(int) * 1, "");