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

containers: fixed templates for MSVC compiler compliancy #282

Merged
merged 4 commits into from
Feb 21, 2022

Conversation

roccoarpa
Copy link
Contributor

The following pull adjusts nomenclature of some templates methods to achieve compliancy with MSVC cl compiler. They do not fix errors in the gnu context, they simply reword methods in an alternative way.

Main mods involve the PiercedStorage/PiercedVector classes (see commits description).

Additionally, rewording on some preprocessor macro was needed (see commit description)

@roccoarpa
Copy link
Contributor Author

Failure on travis build depends on a problem on clang compiler on usage of EnableArgsInitType in template (missing typename). The problem is clang only: code compiles fine on gnu gcc (4.8, 7.3, 9.3) and msvc-vs 2019. Need to investigate more.

@roccoarpa
Copy link
Contributor Author

commit 5611d37 partially reworks commit f0c43b4 to recover compliancy with clang compilers (works on clang 7.0.1 and 10.0.0).
I know, the 2 should be squashed, but i'm waiting for CI response first.

@roccoarpa
Copy link
Contributor Author

squashed abovementioned commits after successfull CI.

MSVC was not able to digest some varyadically templated methods that
used std::enable_if directive to trigger SFINAE. Mismatch in overloading
was reported.

Current solution works on gnu-gcc (4.8, 9.3), llvm-clang(7.0,10.0),
and VS2019-msvc cl
The usage of T in declaration of method's arguments triggers an error
since MSVC does not resolve T=value_t=<pod specified by the class> in
instantiation. In this context, T is used just as a dummy to trigger
SFINAE, so it's safe to use directly original class value_t as method
argument.
…ass methods

According to Visual Studio 2022 documentation (see Compiler Error C2668),
"if, in the same class, you have a regular member function and a templated
member function with the same signature, the templated one must come first.
This limitation remains in the current implementation of Visual C++."
Copy link
Member

@andrea-iob andrea-iob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look fine.

I've updated a couple of comments and renamed EnableArgsInitType to EnableIfHasInitialize.

@andrea-iob andrea-iob merged commit 5e65e46 into master Feb 21, 2022
@andrea-iob andrea-iob deleted the containers.fix.templates.msvc branch February 21, 2022 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants