Skip to content

Fix build on targets where int32_t is not int (LIST_VALUE) - #165

Open
jerrytron wants to merge 1 commit into
JBenda:masterfrom
choosatron:fix/int32-portability-list-value
Open

Fix build on targets where int32_t is not int (LIST_VALUE)#165
jerrytron wants to merge 1 commit into
JBenda:masterfrom
choosatron:fix/int32-portability-list-value

Conversation

@jerrytron

Copy link
Copy Markdown

value::set<value_type::int32> is specialized on int32_t, and int32_t is not int on every target — on Xtensa (ESP32) it is long.

The four LIST_VALUE call sites added in #162 pass a bare 0 and the int returned by get_flag_value(), so on those platforms overload resolution selects the primary template rather than the specialization and the build stops:

value.h:132: error: static assertion failed: No setter for this type defined!
    required from list_operations.h:254

It compiles on x86-64 and arm64 Linux/macOS, where int32_t is int, which is why CI did not catch it.

Every other set<value_type::int32> call site in the tree already converts explicitly — numeric_operations.h, container_operations.cpp, runner_impl.cpp — so this just follows the existing convention rather than introducing one.

Found building for ESP32-S3. ctest passes.

value::set<value_type::int32> is specialized on int32_t, and int32_t is
not int on every target: on Xtensa it is long. So set<int32>(0) and
set<int32>(get_flag_value(...)), which returns int, select the primary
template on those platforms rather than the specialization, and the
build stops on

    static assertion failed: No setter for this type defined!

It compiles on x86-64 and arm64 Linux/macOS, where int32_t is int, so
the four call sites added with LIST_VALUE went unnoticed.

Every other set<value_type::int32> call site in the tree already casts
explicitly - numeric_operations.h, container_operations.cpp,
runner_impl.cpp - so this just follows the existing convention.

Found building for ESP32-S3.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@JBenda

JBenda commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Thanks, good catch

@github-actions

Copy link
Copy Markdown

Ink Proof Results

These results are obtained by running the Ink-Proof Testing Suite on the compiled binaries in this pull request.

System Results
Linux x64 130/130 passed
MacOSX-ARM DISABLED
MacOSX DISABLED
Windows x64 130/130 passed

@JBenda

JBenda commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Would you mind applying this patch? I do not have access rights to your branch, and my OCD would like a green pipeline.

index eb8200a..fa27c3c 100644
--- a/inkcpp/list_operations.h
+++ b/inkcpp/list_operations.h
@@ -336,7 +336,9 @@ public:
 		if (flag.list_id < 0 || flag.flag < 0) {
 			stack.push(value{}.set<value_type::int32>(int32_t{0}));
 		} else {
-			stack.push(value{}.set<value_type::int32>(static_cast<int32_t>(_list_table.get_flag_value(flag))));
+			stack.push(
+			    value{}.set<value_type::int32>(static_cast<int32_t>(_list_table.get_flag_value(flag)))
+			);
 		}
 	}
 };
@@ -354,7 +356,9 @@ public:
 		if (max_flag.list_id < 0 || max_flag.flag < 0) {
 			stack.push(value{}.set<value_type::int32>(int32_t{0}));
 		} else {
-			stack.push(value{}.set<value_type::int32>(static_cast<int32_t>(_list_table.get_flag_value(max_flag))));
+			stack.push(
+			    value{}.set<value_type::int32>(static_cast<int32_t>(_list_table.get_flag_value(max_flag)))
+			);
 		}
 	}
 };

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.

2 participants