[clang] [Clang] Add [[clang::no_specializations]] (PR #101469)
Nikolas Klauser via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 29 11:07:16 PDT 2024
philnik777 wrote:
> > > > I did think about it more, and I think it would be more consistent to support the attribute on any sort of specializable entity, including functions - regardless of STL needs @AaronBallman @ldionne
> > >
> > >
> > > Agreed; if we're adding a custom attribute, we might as well support it in a general form so users can also make use of it for their needs (which may be different than STL needs).
> >
> >
> > While I don't see much of a use-case for functions, I also don't see much of a downside (assuming implementing the attribute is as simple for functions as it is for variables and classes). Is there anything else that can be specialized?
>
> Classes, functions, variables Enumerations... maybe... ish?: https://godbolt.org/z/78qn1hf8d (https://en.cppreference.com/w/cpp/language/template_specialization)
That looks horrendous, but I don't think that's specializing the enum. It's specializing the enclosing class and the specialization happens to also define an enum with the same name as the enum in the base class. You can replace the enum with anything you want, including nothing at all.
https://github.com/llvm/llvm-project/pull/101469
More information about the cfe-commits
mailing list