re PR c++/58305 (Deprecation warning for class not raised when not assigning to a variable)

/cp
2013-09-03  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58305
	* typeck2.c (build_functional_cast): Maybe warn_deprecated_use.

/testsuite
2013-09-03  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58305
	* g++.dg/warn/deprecated-8.C: New.

From-SVN: r202242
This commit is contained in:
Paolo Carlini 2013-09-04 08:57:26 +00:00 committed by Paolo Carlini
parent 7bacbe5c8a
commit 0fbf438441
4 changed files with 33 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2013-09-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58305
* typeck2.c (build_functional_cast): Maybe warn_deprecated_use.
2013-09-03 Mike Stump <mikestump@comcast.net>
* Make-lang.in (cp/lambda.o): Add dependencies.

View File

@ -1761,7 +1761,14 @@ build_functional_cast (tree exp, tree parms, tsubst_flags_t complain)
return error_mark_node;
if (TREE_CODE (exp) == TYPE_DECL)
type = TREE_TYPE (exp);
{
type = TREE_TYPE (exp);
if (complain & tf_warning
&& TREE_DEPRECATED (type)
&& DECL_ARTIFICIAL (exp))
warn_deprecated_use (type, NULL_TREE);
}
else
type = exp;

View File

@ -1,3 +1,8 @@
2013-09-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58305
* g++.dg/warn/deprecated-8.C: New.
2013-09-03 Jeff Law <law@redhat.com>
* tree-ssa/ssa-dom-thread-3.c: Update due to changes in debug

View File

@ -0,0 +1,15 @@
// PR c++/58305
class ToBeDeprecated {
} __attribute__ ((deprecated ("deprecated!")));
typedef ToBeDeprecated NotToBeDeprecated; // { dg-warning "'ToBeDeprecated' is deprecated" }
int main() {
ToBeDeprecated(); // { dg-warning "'ToBeDeprecated' is deprecated" }
ToBeDeprecated x; // { dg-warning "'ToBeDeprecated' is deprecated" }
NotToBeDeprecated();
NotToBeDeprecated y;
}