Skip to content
Snippets Groups Projects
Commit 9010fdba authored by Marek Polacek's avatar Marek Polacek
Browse files

c++: -Wdangling-reference and lambda false warning [PR109640]

-Wdangling-reference checks if a function receives a temporary as its
argument, and only warns if any of the arguments was a temporary.  But
we should not warn when the temporary represents a lambda or we generate
false positives as in the attached testcases.

	PR c++/113256
	PR c++/111607
	PR c++/109640

gcc/cp/ChangeLog:

	* call.cc (do_warn_dangling_reference): Don't warn if the temporary
	is of lambda type.

gcc/testsuite/ChangeLog:

	* g++.dg/warn/Wdangling-reference14.C: New test.
	* g++.dg/warn/Wdangling-reference15.C: New test.
	* g++.dg/warn/Wdangling-reference16.C: New test.
parent ed4c7893
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment