Open fdfade6f-6190-49d4-b4d3-840965bb8b0c opened 11 years ago
This has bitten us again: https://gitlab.dune-project.org/core/dune-common/merge_requests/464#note_41116
All versions of clang up to 5.0 seem to be affected according to godbolt: https://godbolt.org/g/Cpsbd7
godbolt does not support clang 6 at the moment, so I can't easily test that.
All forms of deprecating seem to be affected: [[deprecated(msg)]], attribute((deprecated(msg))), attribute((deprecated(msg)))
To state the problem more precisely, the deprecation message is only missing when templates are not specified.
template <class T>
struct NewClassName
{
// ...
};
template <class T> using OldClassNameUsing __attribute__ ((deprecated))
= NewClassName<T>;
using OldClassNameWithoutTemplateUsing __attribute__ ((deprecated))
= NewClassName<int>;
typedef NewClassName<int> OldClassNameTypedef __attribute__ ((deprecated));
int main()
{
OldClassNameUsing<int> objectUsing; // no deprecation warning
OldClassNameWithoutTemplateUsing objectWithoutTemplateUsing; // emits warning
OldClassNameTypedef objectTypedef; // emits warning
return 0;
}
Seems to be true for Clang 14, too.
this affected me as well - https://godbolt.org/z/W9YacdGv3 (clang 16) we don't even hope that MSVC will be a reasonable compiler in the near future, but clang? just why?
@llvm/issue-subscribers-clang-frontend
Confirmed: https://godbolt.org/z/WfheGb8sh
Extended Description
I want to rename a templated class. To make the transition easier for the users, I'd like to keep the old class for one more version and mark it deprecated with the extensions from GCC / Clang (attribute deprecated). To avoid keeping an exact copy of the deprecated class, the use of template alias would be handy. Unfortunately Clang (3.3 and recent trunk) does not emit a warning (GCC does) for the following code in line 14:
Clang used: clang version 3.4 (194323) Target: x86_64-unknown-linux-gnu Thread model: posix