cppfront icon indicating copy to clipboard operation
cppfront copied to clipboard

Add a second `cpp2::range` constructor which takes 2 types, and deduce the common type for them (if available)

Open bluetarpmedia opened this issue 5 months ago • 0 comments

Use a CTAD deduction guide to deduce the std::common_type for both types (if a common one exists).

This allows code like the following to compile without integer precision conversion warnings:

for 0 ..< vector.size() do (e) { ... }

since the integer literal 0 and the size expression evaluate as different signed/unsigned types.

Also update the regression tests after recent changes.

Fixes #1269

bluetarpmedia avatar Sep 03 '24 04:09 bluetarpmedia