Skip to content

[interop] Pass template names and named constants as template arguments - #62

Open
conrade-ctc wants to merge 2 commits into
compiler-research:mainfrom
chicagotrading:pr-c-template-args
Open

[interop] Pass template names and named constants as template arguments#62
conrade-ctc wants to merge 2 commits into
compiler-research:mainfrom
chicagotrading:pr-c-template-args

Conversation

@conrade-ctc

Copy link
Copy Markdown
Contributor

A template argument can now name a template or a constant. A class or alias template name becomes a template-template argument. A constexpr variable or an enum constant becomes an expression, so Sema reads its value. true and false become bool values. The first commit fixes a separate bug: is_integral rejected a leading minus, so a negative literal became a type name.

The by-name paths need CppInterOp compiler-research/CppInterOp#1074, which resolves the name and exports a capability marker. cppjit probes for the marker and keeps the paths off when it is absent. The guarded test then skips.

is_integral rejects a leading minus, so the comma-split fallback in
AppendTypesSlow reads a negative literal as a type name. Accept the sign.

Co-developed-with-the-help-of: Claude Code (Opus 5, human in the loop)
A class or alias template name becomes a template-template argument. The
argument carries the name and a null type. A constexpr variable or an enum
constant goes through as its qualified name, so Sema builds an expression.
true and false become bool values.

The by-name paths need a CppInterOp that resolves the name. An older one
reads the name as an integer literal and instantiates a garbage value.
Probe for CppInterOp's SupportsNamedTemplateArguments export, and skip the
test when it is absent.

Co-developed-with-the-help-of: Claude Code (Fable 5, human in the loop)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant