* C++ PATCH for c++/52845 (bogus warning with empty lambda)
@ 2012-04-04 14:39 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2012-04-04 14:39 UTC (permalink / raw)
To: gcc-patches List
[-- Attachment #1: Type: text/plain, Size: 209 bytes --]
My patch for return type deduction forgot to update the fntype local
variable in finish_function, leading to a bogus warning about a missing
return statement.
Tested x86_64-pc-linux-gnu, applying to trunk.
[-- Attachment #2: 52845.patch --]
[-- Type: text/x-patch, Size: 910 bytes --]
commit 12a282edca78579074f5f4180cd2dce1edebd2bf
Author: Jason Merrill <jason@redhat.com>
Date: Wed Apr 4 10:14:46 2012 -0400
PR c++/52845
* decl.c (finish_function): Update fntype after deducing return type.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index d210f19..e2f01d5 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -13518,6 +13518,7 @@ finish_function (int flags)
"deduced to %<void%>");
}
apply_deduced_return_type (fndecl, void_type_node);
+ fntype = TREE_TYPE (fndecl);
}
/* Save constexpr function body before it gets munged by
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn4.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn4.C
new file mode 100644
index 0000000..2afeccf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn4.C
@@ -0,0 +1,7 @@
+// PR c++/52845
+// { dg-options "-std=c++11 -Wall" }
+
+void f()
+{
+ [](){};
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-04-04 14:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-04 14:39 C++ PATCH for c++/52845 (bogus warning with empty lambda) Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).