[PATCH] D144285: [Clang] Implement CWG2518 - static_assert(false)
Corentin Jabot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 17 11:17:07 PST 2023
cor3ntin marked 2 inline comments as done.
cor3ntin added inline comments.
================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:16805
+ // definition, the declaration has no effect.
+ bool InTemplateDefinition = getLangOpts().CPlusPlus && getTemplateDepth(getCurScope()) != 0;
+
----------------
erichkeane wrote:
> cor3ntin wrote:
> > erichkeane wrote:
> > > Hmm... interesting way to calculate template depth, I wasn't aware of that one. Does this cause problems in 'a template caused another template to instantiate' sorta thing?
> > >
> > > Also, is the "CPlusPlus" test here necessary?
> > It's what I came up with. Do you think there is a better way?
> > If you have suggestions for additional tests, I'm all ears!
> >
> > The CplusPlus tests is just there to avoid unnecessary cycles in C mode. It probably doesn't do much of a difference.
> For "Zero" I usually would just check if the current decl-context is dependent. I'm not positive if that is 'correct' without more thought, though I would expect it to be? I think we make sure that is set up correctly everywhere. it would at least be a good check to see where we mess that up :)
Yes, i feel stupid now, that was the obvious solution! Thanks
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144285/new/
https://reviews.llvm.org/D144285
More information about the cfe-commits
mailing list