cppalliance / safe-cpp

Boost Software License 1.0
152 stars 13 forks source link

compiler: Lifetime normalization bug #26

Closed seanbaxter closed 1 month ago

seanbaxter commented 1 month ago
#feature on safety

template<typename T>
void call/(where T:static)(T);

int main() {
  void(*pf)(int) = addr call<int>;
}

This fails to convert. The problem is that lifetime normalization isn't stripping the unused T:static outlives-constraint, which means the /static lifetime parameter stays a part of the lifetime descriptor, and the rhs of the assignment doesn't have the same type as the lhs of the assignment. Currently template substitution of outlives-constraints is performed during lifetime canonicalization--but that's too late! It has to be moved up.

seanbaxter commented 1 month ago

Fixed in build_sep_18_2024-1.