if (TREE_CODE (ftype) == ARRAY_TYPE
&& (BRACE_ENCLOSED_INITIALIZER_P (val)
|| TREE_CODE (val) == STRING_CST))
- ftype = (cp_build_reference_type
- (ftype, BRACE_ENCLOSED_INITIALIZER_P (val)));
+ {
+ if (TREE_CODE (val) == STRING_CST)
+ ftype = cp_build_qualified_type
+ (ftype, cp_type_quals (ftype) | TYPE_QUAL_CONST);
+ ftype = (cp_build_reference_type
+ (ftype, BRACE_ENCLOSED_INITIALIZER_P (val)));
+ }
list = tree_cons (arg, ftype, list);
}
--- /dev/null
+// { dg-do compile { target c++20 } }
+
+template <class T, int N>
+struct A
+{
+ T ar[N];
+};
+
+A a = { "foo" };
+
+template<class, class> struct same;
+template<class T> struct same<T,T> {};
+same<decltype (a.ar), char[4]> s;
+