/cp
2019-08-02 Paolo Carlini <paolo.carlini@oracle.com>
* tree.c (handle_nodiscard_attribute): Do not warn about nodiscard
applied to a constructor.
/testsuite
2019-08-02 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/cpp1z/nodiscard6.C: New.
From-SVN: r274002
+2019-08-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * tree.c (handle_nodiscard_attribute): Do not warn about nodiscard
+ applied to a constructor.
+
2019-08-02 Martin Liska <mliska@suse.cz>
* decl.c (grok_op_properties):
{
if (TREE_CODE (*node) == FUNCTION_DECL)
{
- if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (*node))))
+ if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (*node)))
+ && !DECL_CONSTRUCTOR_P (*node))
warning_at (DECL_SOURCE_LOCATION (*node),
OPT_Wattributes, "%qE attribute applied to %qD with void "
"return type", name, *node);
+2019-08-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * g++.dg/cpp1z/nodiscard6.C: New.
+
2019-08-02 Senthil Kumar Selvaraj <senthilkumar.selvaraj@microchip.com>
* gcc.dg/torture/ssa-fre-5.c: Add dg-require-effective-target int32.
--- /dev/null
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+ [[nodiscard]] A();
+};
+
+void foo()
+{
+ A(); // { dg-warning "ignoring return value" }
+}