===================================================================
@@ -5305,20 +5305,25 @@ finish_decltype_type (tree expr, bool id
/* If the expression is just "this", we want the
cv-unqualified pointer for the "this" type. */
type = TYPE_MAIN_VARIANT (TREE_TYPE (expr));
else
{
/* Otherwise, where T is the type of e, if e is an lvalue,
decltype(e) is defined as T&; if an xvalue, T&&; otherwise, T. */
cp_lvalue_kind clk = lvalue_kind (expr);
type = unlowered_expr_type (expr);
gcc_assert (TREE_CODE (type) != REFERENCE_TYPE);
+
+ /* For vector types, pick a non-opaque variant. */
+ if (TREE_CODE (type) == VECTOR_TYPE)
+ type = cp_build_qualified_type (TYPE_MAIN_VARIANT (type),
+ cp_type_quals (type));
if (clk != clk_none && !(clk & clk_class))
type = cp_build_reference_type (type, (clk & clk_rvalueref));
}
}
return type;
}
/* Called from trait_expr_value to evaluate either __has_nothrow_assign or
__has_nothrow_copy, depending on assign_p. */
===================================================================
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu++11 -Wall" } */
+
+typedef float v4f __attribute__((vector_size(4*sizeof(float))));
+
+template <class T> void eat (T&&) {}
+
+void test1 ()
+{
+ v4f x = {0,1,2,3};
+ typedef decltype (x < x) v4i;
+ v4i y = {4,5,6,7}; // v4i is not opaque
+ eat (y);
+}
+
+template<class V>
+void test2 ()
+{
+ V x = {0,1,2,3};
+ typedef decltype (x < x) v4i;
+ v4i y = {4,5,6,7}; // v4i is not opaque
+ eat (y);
+}
+
+int main(){
+ test1();
+ test2<v4f>();
+}