On 05/07/2015 09:59 AM, Marek Polacek wrote:
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
Instead of NULL_TREE in pt.c I grabbed the attrs.
/* Actually build the enumerator itself. */
build_enumerator
(DECL_NAME (decl), value, newtag, DECL_ATTRIBUTES (decl),
DECL_SOURCE_LOCATION (decl));
Seems to work.
Also, I haven't tested the testcase in terms of the pattern matching of
the error. Tweak it if necessary.
Thanks for this.
Ed
// PR c/47046
// { dg-do compile { target c++11 } }
class C
{
public:
enum Foo
{
T,
U [[deprecated("unused")]],
V
};
};
template<typename Tp>
class D
{
public:
enum Bar
{
X,
Y [[deprecated("unused")]],
Z
};
};
int
f (int i)
{
auto j = C::U; // { dg-warning ".C::U. is deprecated" }
auto k = D<int>::Y; // { dg-warning ".D<int>::Y. is deprecated" }
return i;
}