2014-06-05 Richard Biener <rguenther@suse.de>
PR c++/61004
* typeck.c (cp_build_indirect_ref): Do not emit strict-aliasing
warnings for accessing empty classes.
* g++.dg/diagnostic/pr61004.C: New testcase.
From-SVN: r211272
+2014-06-05 Richard Biener <rguenther@suse.de>
+
+ PR c++/61004
+ * typeck.c (cp_build_indirect_ref): Do not emit strict-aliasing
+ warnings for accessing empty classes.
+
2014-06-05 Marek Polacek <polacek@redhat.com>
PR c/49706
of the result is "T." */
tree t = TREE_TYPE (type);
- if (CONVERT_EXPR_P (ptr)
- || TREE_CODE (ptr) == VIEW_CONVERT_EXPR)
+ if ((CONVERT_EXPR_P (ptr)
+ || TREE_CODE (ptr) == VIEW_CONVERT_EXPR)
+ && (!CLASS_TYPE_P (t) || !CLASSTYPE_EMPTY_P (t)))
{
/* If a warning is issued, mark it to avoid duplicates from
the backend. This only needs to be done at
+2014-06-05 Richard Biener <rguenther@suse.de>
+
+ PR c++/61004
+ * g++.dg/diagnostic/pr61004.C: New testcase.
+
2014-06-05 Yuri Rumyantsev <ysrumyan@gmail.com>
* gcc.dg/torture/pr61319.c: New test.
--- /dev/null
+// { dg-do compile }
+// { dg-options "-O2 -Wall" }
+
+struct A{ };
+struct B:A{};
+void f(A const&);
+int main()
+{
+ B b;
+ f(b); // { dg-bogus "strict-aliasing" }
+}