PR c++/84364
* typeck.c (check_return_expr): Don't emit -Weffc++ warning
about return other than *this in assignment operators if
retval is type dependent expression.
* g++.dg/warn/effc4.C: New test.
From-SVN: r257640
+2018-02-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84364
+ * typeck.c (check_return_expr): Don't emit -Weffc++ warning
+ about return other than *this in assignment operators if
+ retval is type dependent expression.
+
2018-02-13 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84333
/* Effective C++ rule 15. See also start_function. */
if (warn_ecpp
- && DECL_NAME (current_function_decl) == assign_op_identifier)
+ && DECL_NAME (current_function_decl) == assign_op_identifier
+ && !type_dependent_expression_p (retval))
{
bool warn = true;
+2018-02-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84364
+ * g++.dg/warn/effc4.C: New test.
+
2018-02-13 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84333
--- /dev/null
+// PR c++/84364
+// { dg-do compile }
+// { dg-options "-Weffc++" }
+
+template <typename T>
+struct A {
+ A &operator=(A<T>& f) {
+ return *this; // { dg-bogus "should return a reference to" }
+ }
+};