]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/cp/typeck.c
PR target/63764
[thirdparty/gcc.git] / gcc / cp / typeck.c
index 71568515389516a88cca5c30adfb4066482d8635..e100d70b1f2d7353a4e8292f162566edd85279cb 100644 (file)
@@ -3072,7 +3072,8 @@ cp_build_array_ref (location_t loc, tree array, tree idx,
       break;
     }
 
-  convert_vector_to_pointer_for_subscript (loc, &array, idx);
+  bool non_lvalue
+    = convert_vector_to_pointer_for_subscript (loc, &array, idx);
 
   if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE)
     {
@@ -3155,6 +3156,8 @@ cp_build_array_ref (location_t loc, tree array, tree idx,
       ret = require_complete_type_sfinae (fold_if_not_in_template (rval),
                                          complain);
       protected_set_expr_location (ret, loc);
+      if (non_lvalue)
+       ret = non_lvalue_loc (loc, ret);
       return ret;
     }
 
@@ -3194,6 +3197,8 @@ cp_build_array_ref (location_t loc, tree array, tree idx,
                                  RO_ARRAY_INDEXING,
                                  complain);
     protected_set_expr_location (ret, loc);
+    if (non_lvalue)
+      ret = non_lvalue_loc (loc, ret);
     return ret;
   }
 }