AZero13 wrote:

> Could you please elaborate the motivation of this PR?
> 
> > Exempted DeclaratorContext::TypeName from the check. Abstract declarator 
> > contexts (used by typeof, sizeof, C-style casts) now properly bypass this 
> > restricted rule, matching how TemplateArg was already correctly exempted.
> 
> Could you please explain the "properly"? It would be quite useful to 
> reference C++ standard. I don't think "typeof, sizeof, C-style casts" are 
> affected by CWG1417.

Currently there are only two ways to make a template that accepts either a 
value or a type, using class template overloads or wrapping the argument in 
typeof to convert values to types (decltype would work if it also accepted 
types, but it doesn't).

So even if you use a macro wrapper to hide the jank like
```#define EXAMPLE(arg) example<typeof(arg)>```
clang will completely fail in the specific edge case of abominable functions 
and there's no workaround without this.

As for the standard: I checked the other day when I saw the typeid comment and 
that's the only thing besides pointers/references that explicitly forbids 
cv-qualified function types.

https://github.com/llvm/llvm-project/pull/209836
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to