@@ -977,11 +977,12 @@ rvalue (tree expr)
expr = mark_rvalue_use (expr);
- /* [basic.lval]
-
- Non-class rvalues always have cv-unqualified types. */
+ /* [expr.type]: "If a prvalue initially has the type "cv T", where T is a
+ cv-unqualified non-class, non-array type, the type of the expression is
+ adjusted to T prior to any further analysis. */
type = TREE_TYPE (expr);
- if (!CLASS_TYPE_P (type) && cv_qualified_p (type))
+ if (!CLASS_TYPE_P (type) && TREE_CODE (type) != ARRAY_TYPE
+ && cv_qualified_p (type))
type = cv_unqualified (type);
/* We need to do this for rvalue refs as well to get the right answer
new file mode 100644
@@ -0,0 +1,12 @@
+// PR c++/111286
+// { dg-do compile { target c++11 } }
+// { dg-additional-options -Wno-unused }
+
+struct A {
+ A() noexcept {}
+};
+
+void foo() {
+ using T = const A (&)[1];
+ T{};
+}