2009-10-31 Jason Merrill <jason@redhat.com>
+ * tree.c (cv_unqualified): New fn.
+ * cp-tree.h: Declare it.
+ * typeck.c (decay_conversion): Use it instead of TYPE_MAIN_VARIANT.
+
* rtti.c (tinfo_name): Fix lengths for private case.
2009-10-31 Jason Merrill <jason@redhat.com>
extern tree cp_build_qualified_type_real (tree, int, tsubst_flags_t);
#define cp_build_qualified_type(TYPE, QUALS) \
cp_build_qualified_type_real ((TYPE), (QUALS), tf_warning_or_error)
+extern tree cv_unqualified (tree);
extern special_function_kind special_function_p (const_tree);
extern int count_trees (tree);
extern int char_type_p (tree);
return result;
}
+/* Return TYPE with const and volatile removed. */
+
+tree
+cv_unqualified (tree type)
+{
+ int quals = TYPE_QUALS (type);
+ quals &= ~(TYPE_QUAL_CONST|TYPE_QUAL_VOLATILE);
+ return cp_build_qualified_type (type, quals);
+}
+
/* Builds a qualified variant of T that is not a typedef variant.
E.g. consider the following declarations:
typedef const int ConstInt;
Non-class rvalues always have cv-unqualified types. */
type = TREE_TYPE (exp);
if (!CLASS_TYPE_P (type) && cp_type_quals (type))
- exp = build_nop (TYPE_MAIN_VARIANT (type), exp);
+ exp = build_nop (cv_unqualified (type), exp);
return exp;
}
+2009-10-31 Richard Guenther <rguenther@suse.de>
+
+ * g++.dg/tree-ssa/restrict1.C: New.
+
2009-10-31 Jason Merrill <jason@redhat.com>
* g++.dg/rtti/typeid9.C: New.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-lim-details" } */
+
+struct Foo
+{
+ Foo();
+ Foo(const Foo&);
+ int n;
+ int * __restrict__ p;
+};
+void bar(Foo f, int * __restrict__ q)
+{
+ for (int i = 0; i < f.n; ++i)
+ {
+ *q += f.p[i];
+ }
+}
+
+/* { dg-final { scan-tree-dump "Executing store motion" "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim1" } } */