This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)
- From: Marek Polacek <polacek at redhat dot com>
- To: Ed Smith-Rowland <3dw4rd at verizon dot net>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>, Jason Merrill <jason at redhat dot com>
- Date: Thu, 7 May 2015 15:59:55 +0200
- Subject: Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)
- Authentication-results: sourceware.org; auth=none
- References: <554AD940 dot 3000800 at verizon dot net>
On Wed, May 06, 2015 at 11:17:20PM -0400, Ed Smith-Rowland wrote:
> In addition to a PR this is 1/2 of a C=+17 feature. (The other half - really
> a separate thing - is attributes on namespaces).
Ah, nice, I wasn't aware. For the record, this is
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4266.html>.
> I wonder if we should pedwarn for < C++17?
> Or it could be just an extension for < C++17 - I guess that would match with
> clang.
Yeah, it is meant as a GNU extension. (clang supports this extension for
several years already.) I'd rather let Jason decide what to do wrt C++17.
> @@ -3651,11 +3651,6 @@ finish_id_expression (tree id_expression,
> }
> }
>
> - /* Handle references (c++/56130). */
> - tree t = REFERENCE_REF_P (decl) ? TREE_OPERAND (decl, 0) : decl;
> - if (TREE_DEPRECATED (t))
> - warn_deprecated_use (t, NULL_TREE);
> -
> return decl;
> }
>
> Why did this bit get removed?
This hunk got added in r201906 to address c++/56130 - we didn't warn for
deprecated references:
int g_nn;
int& g_n __attribute__((deprecated)) = g_nn;
int main()
{
g_n = 1;
}
But then Jason added warn_deprecated_use to mark_used in r217677 and we
warned twice. So I figured the warning in finish_id_expression isn't
needed anymore.
> Do we handle enums in template specializations?
Not sure, could you provide a testcase? Thanks,
Marek