zwuis wrote: > 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).
C++ doesn't have "class template overloads" and clang doesn't support them. I think this is out of the scope of this PR. > 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. So the motivation is to make things like `typeof(void() const)` work, not affecting `sizeof` and C-style cast? > 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. The wording changes in CWG1417 clearly state where cv-qualified function types **can** be used. I don't see the relation between the motivation of this PR and CWG1417 currently. Note that `typeof` is not part of standard C++. https://github.com/llvm/llvm-project/pull/209836 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
