2006-10-29 Dirk Mueller <dmueller@suse.de>
PR c++/16307
* typeck.c (build_array_ref): Warn for char subscriptions
on pointers.
* g++.dg/warn/Wchar-subscripts-2.C: New testcase.
From-SVN: r118154
+2006-10-29 Dirk Mueller <dmueller@suse.de>
+
+ PR c++/16307
+ * typeck.c (build_array_ref): Warn for char subscriptions
+ on pointers.
+
2006-10-29 Kazu Hirata <kazu@codesourcery.com>
* decl.c: Fix a comment typo.
return error_mark_node;
}
+ warn_array_subscript_with_type_char (idx);
+
return build_indirect_ref (cp_build_binary_op (PLUS_EXPR, ar, ind),
"array indexing");
}
+2006-10-29 Dirk Mueller <dmueller@suse.de>
+
+ PR c++/16307
+ * g++.dg/warn/Wchar-subscripts-2.C: New testcase.
+
2006-10-29 Roger Sayle <roger@eyesopen.com>
PR tree-optimization/15458
--- /dev/null
+/* PR c++/16307 */
+// { dg-do compile }
+// { dg-options "-Wchar-subscripts" }
+
+char foo (const char *s)
+{
+ return s [s ['\x80']]; // { dg-warning "array subscript" }
+}
+
+int main ()
+{
+ foo ("\x80");
+}