hsutter / cppfront

A personal experimental C++ Syntax 2 -> Syntax 1 compiler
Other
5.24k stars 224 forks source link

[cpp2util] as: add constexpr branch for optionals #1062

Closed sookach closed 1 month ago

sookach commented 1 month ago

Aims to resolve #1061. This issue is very similar to #1057, where the as for optionals is defined after the general function. @hsutter @filipsajdak Would definitely like to hear some feedback/suggestions for how to handle this bug. My solution was to add a 'type trait' for checking if a type is an optional, but I'm not sure if this fits into cpp2's design philosophy. @bluetarpmedia I tested this on macos with clang18, let me know if this fix works for you. Thanks everyone!