Commit 0940fe59 by Marek Polacek Committed by Marek Polacek

re PR c++/87080 (ice in cp_get_fndecl_from_callee, at cp/cvt.c:965)

	PR c++/87080
	* typeck.c (maybe_warn_pessimizing_move): Do nothing in a template.

	* g++.dg/cpp0x/Wpessimizing-move5.C: New test.

From-SVN: r263862
parent 376384e4
2018-08-26 Marek Polacek <polacek@redhat.com>
PR c++/87080
* typeck.c (maybe_warn_pessimizing_move): Do nothing in a template.
2018-08-24 Marek Polacek <polacek@redhat.com> 2018-08-24 Marek Polacek <polacek@redhat.com>
PR c++/67012 PR c++/67012
......
...@@ -9192,6 +9192,11 @@ maybe_warn_pessimizing_move (tree retval, tree functype) ...@@ -9192,6 +9192,11 @@ maybe_warn_pessimizing_move (tree retval, tree functype)
if (cxx_dialect < cxx11) if (cxx_dialect < cxx11)
return; return;
/* Wait until instantiation time, since we can't gauge if we should do
the NRVO until then. */
if (processing_template_decl)
return;
/* This is only interesting for class types. */ /* This is only interesting for class types. */
if (!CLASS_TYPE_P (functype)) if (!CLASS_TYPE_P (functype))
return; return;
......
2018-08-26 Marek Polacek <polacek@redhat.com>
PR c++/87080
* g++.dg/cpp0x/Wpessimizing-move5.C: New test.
2018-08-25 Thomas Koenig <tkoenig@gcc.gnu.org> 2018-08-25 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/86704 PR libfortran/86704
......
// PR c++/87080
// { dg-do compile { target c++11 } }
// { dg-options "-Wpessimizing-move" }
struct a {
template<typename b> a &operator<<(b);
};
a c();
template<typename>
a fn2()
{
int d = 42;
return c() << d;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment