When deprecated is and isn't allowed on local declarations is not consistent.
compiles:
void main()
{
deprecated class Foo
{
}
}
void main()
{
deprecated void foo()
{
}
}
void main()
{
deprecated int i;
}
does not compile:
void main()
{
deprecated("Deprecated in Qt version 5.3") class Foo
{
}
}
void main()
{
deprecated("Deprecated in Qt version 5.3") void foo()
{
}
}
void main()
{
deprecated("Deprecated in Qt version 5.3") int i;
}
void main()
{
deprecated enum Enum
{
a,
b,
c,
d,
}
}
void main()
{
deprecated("Deprecated in Qt version 5.3")
enum Enum
{
a,
b,
c,
d,
}
}
The fix for issue #11689 fixed at least some of the cases where deprecated didn't work on local symbols, but either it didn't fix them all, or a change since then broke some of them. In particular, deprecated on local enum declarations doesn't work, and having a deprecation message on local declarations never works.
Personally, I find this very annoying, because I'm trying to test code generation by mixing the generated code into a unittest block, and that doesn't consistently work right now if the local declaration is deprecated.
Comment #1 by andrei — 2017-06-06T21:13:27Z
*** Issue 17471 has been marked as a duplicate of this issue. ***
Comment #2 by robert.schadek — 2024-12-13T18:51:42Z