[clang] [clang] CTAD: implement the missing IsDeducible constraint for alias templates (PR #89358)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 26 02:14:21 PDT 2024


hokein wrote:

It appears that the consensus is to avoid exposing the internal `__is_deducible` type trait to end-users, as there are no compelling use cases and it's not expected to be used in libc++. This also aligns with the approach taken by GCC.

Regarding implementation, the current tablegen-based mechanism doesn't offer an optimal solution for defining internal-only builtins. Several options:

1) Making manual changes in the `TypeTrait` structure code, as proposed by @AaronBallman. While feasible, this approach may be somewhat hacky and would require modifications in multiple places (please see the current implementation, which involves four locations).
2) Following the standard defining-builtin approach but emitting a diagnostic warning when Clang parses `__is_deducible`. This option seems to strike the right balance, as it provides a compromise between adherence to clang's standard implementation and user guidance. Additionally, it would allow for dedicated lit tests for this type trait.
3) Following the standard approach but omitting the type trait name in the `TYPE_TRAIT_2` macro, as suggested by @cor3ntin. However, this approach will affect components that need to print the type-trait name (e.g., AST dump, diagnostics).

Opinions and thoughts would be appreciated, @AaronBallman, @cor3ntin, @erichkeane 


https://github.com/llvm/llvm-project/pull/89358


More information about the cfe-commits mailing list