/cp
2015-04-29 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/64667
* init.c (perform_member_init): Handle references for -Winit-self.
/testsuite
2015-04-29 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/64667
* g++.dg/warn/Winit-self-3.C: New.
From-SVN: r222577
+2015-04-29 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/64667
+ * init.c (perform_member_init): Handle references for -Winit-self.
+
2015-04-29 Thomas Schwinge <thomas@codesourcery.com>
* pt.c (tsubst_expr) <OMP_TARGET_UPDATE>: Use
&& TREE_CHAIN (init) == NULL_TREE)
{
tree val = TREE_VALUE (init);
+ /* Handle references. */
+ if (REFERENCE_REF_P (val))
+ val = TREE_OPERAND (val, 0);
if (TREE_CODE (val) == COMPONENT_REF && TREE_OPERAND (val, 1) == member
&& TREE_OPERAND (val, 0) == current_class_ref)
warning_at (DECL_SOURCE_LOCATION (current_function_decl),
+2015-04-29 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/64667
+ * g++.dg/warn/Winit-self-3.C: New.
+
2015-04-29 Uros Bizjak <ubizjak@gmail.com>
* gfortran.dg/namelist_87.f90: Use dg-add-options ieee.
--- /dev/null
+// PR c++/64667
+// { dg-options "-Winit-self" }
+
+class A
+{
+public:
+ A(const A&) : a(a) {} // { dg-warning "initialized with itself" }
+private:
+ int a;
+};
+
+class B
+{
+public:
+ B(const B&) : b(b) {} // { dg-warning "initialized with itself" }
+private:
+ int* b;
+};
+
+class C
+{
+public:
+ C(const C&) : c(c) {} // { dg-warning "initialized with itself" }
+private:
+ int& c;
+};