Skip to content

Print namespace-scope typedefs of builtins by their typedef name#28

Merged
Wentzell merged 2 commits into
unstablefrom
fix_typedef_print_for_builtins
Jun 26, 2026
Merged

Print namespace-scope typedefs of builtins by their typedef name#28
Wentzell merged 2 commits into
unstablefrom
fix_typedef_print_for_builtins

Conversation

@Wentzell

@Wentzell Wentzell commented Jun 11, 2026

Copy link
Copy Markdown
Member

Avoid replacing typedef aliases to built-in types, such as size_t or std::uint64_t.

gfqn_impl1 checked getAs<BuiltinType>() before getAs<TypedefType>().
Since getAs<> looks through sugar, a typedef of a builtin such as
std::uint64_t matched the builtin branch first and was printed with
its canonical spelling, which is platform dependent (unsigned long
long on macOS vs unsigned long on Linux LP64). Inside composite types
this changes the type, e.g. std::vector<unsigned long long> does not
convert to std::vector<std::uint64_t> on Linux, so committed wrap
files generated on macOS failed to compile there.

Prefer the typedef spelling only for typedefs declared at namespace
or translation-unit scope: member typedefs (e.g. of a class template)
keep the canonical builtin print, as their qualified name can lose
the template arguments (detail::linear::index_t).

Assisted-by: Claude <[email protected]>
@Wentzell
Wentzell force-pushed the fix_typedef_print_for_builtins branch from 5e4dfe2 to b8befbb Compare June 11, 2026 16:51
c2py declares the same option with default OFF at its top level, which
lands in the cache before doc/ is configured. The getting_started
example's own option(... ON) then becomes a no-op, the
*_bindings_generation target is never created, and the docs CI fails
compiling getting_started.cpp with 'getting_started.wrap.cxx file not
found'. Set the value as a normal variable in doc/CMakeLists.txt so it
overrides the cache for the docs scope only.

Assisted-by: Claude <[email protected]>
@Wentzell
Wentzell merged commit 690e779 into unstable Jun 26, 2026
2 of 3 checks passed
@Wentzell
Wentzell deleted the fix_typedef_print_for_builtins branch June 26, 2026 15:52
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