Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed VS2022 17.8.0 and clang compilation of the SceneAPI PairIterato… #17008

Merged

Conversation

alexmontAmazon
Copy link
Contributor

Fix VS2022 compile via cherry pick of:
dee68ec

original commit message:

  • Fixed VS2022 17.8.0 and clang compilation of the SceneAPI PairIterator Tests

The call to AZStd::reverse failed to the pair swap only supporting non-const pairs.
In this particular case a const pair of int& const pair<int&, int&> were attempted to be swapped which did not compile.
Een though the pair itself is const, the elements in it are refrences to non-const types and there they are still swappable.

Moved the pair class implementation from the utils.h header into it's own pair.h/pair.inl

Added forwarding headers for pair, tuple and subrange that allows them to be referenced without needing a complete defintion. This allows circular includes to be avoided between the tuple.h, pair.h and subrange.h header as they all need to know about the other types for their constructors.

Add an implementation of the C++20 std::ranges::reverse which can reverse a range container in place.

  • Fixed clang compile error

The common_type specializations of AZStd::pair and std::tuple needs to occur in the std:: namespace, as that is where the `common_type structure is originally defined.

  • Moved specialization of tuple_size/tuple_element for AZStd::pair/AZStd::array

The AZStd::pair class needs std::tuple_element to be specialized before the declaration of the AZStd::get overloads for the AZStd::pair class in order to compile using clang/gcc.

  • Fix iterator swap for SceneAPI PairIterator to move the values into a temporary.

  • Clang tuple_element fixes.

  • Clang build fixes for AZStd::pair changes

  • Updated the AZStd::pair pair-like constructor/assignment operators

The pair-like functions are used to construct an AZStd::pair from a tuple, subrange or array of size 2.

The constraint checking on the functions causing an instantiation of the supplied pair-like template argument, therefore causing the AZStd::pair class to require a complete type.

That was cause of compilation issues when using clang.

Tested Locally in Editor

…r Tests (o3de#16634)

* Fixed VS2022 17.8.0 and clang compilation of the SceneAPI PairIterator Tests

The call to `AZStd::reverse` failed to the pair swap only supporting
non-const pairs.
In this particular case a const pair of int& `const pair<int&, int&>` were attempted to be
swapped which did not compile.
Een though the pair itself is const, the elements in it are refrences to
non-const types and there they are still swappable.

Moved the pair class implementation from the utils.h header into it's
own `pair.h/pair.inl`

Added forwarding headers for pair, tuple and subrange that allows them
to be referenced without needing a complete defintion.
This allows circular includes to be avoided between the tuple.h, pair.h
and subrange.h header as they all need to know about the other types for
their constructors.

Add an implementation of the C++20 `std::ranges::reverse` which can
reverse a range container in place.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Fixed clang compile error

The `common_type` specializations of AZStd::pair and std::tuple needs to
occur in the std:: namespace, as that is where the `common_type structure is
originally defined.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Moved specialization of tuple_size/tuple_element for AZStd::pair/AZStd::array

The AZStd::pair class needs `std::tuple_element` to be specialized
before the declaration of the `AZStd::get` overloads for the AZStd::pair
class in order to compile using clang/gcc.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Fix iterator swap for SceneAPI PairIterator to move the values into a
temporary.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Clang tuple_element fixes.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Clang build fixes for AZStd::pair changes

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Updated the `AZStd::pair` pair-like constructor/assignment operators

The pair-like functions are used to construct an AZStd::pair from a tuple, subrange or array of size 2.

The constraint checking on the functions causing an instantiation of the supplied pair-like template argument, therefore causing the `AZStd::pair` class to require a complete type.

That was cause of compilation issues when using clang.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

---------

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
Signed-off-by: Alex Montgomery <alexmont@amazon.com>
@alexmontAmazon alexmontAmazon merged commit d005706 into o3de:point-release/23101 Nov 3, 2023
3 checks passed
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.

None yet

3 participants