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

too few template aruments #357

Closed
1 of 2 tasks
Michael-Lafreniere opened this issue Jun 7, 2024 · 5 comments
Closed
1 of 2 tasks

too few template aruments #357

Michael-Lafreniere opened this issue Jun 7, 2024 · 5 comments

Comments

@Michael-Lafreniere
Copy link

Description

Just including the node.hpp file (nothing else) generates two errors in visual studio 2022 Version 17.10.1.

The first one: error C2976: 'fkyaml::v0_3_8::node_value_converter': too few template arguments
The second one: error C2955: 'fkyaml::v0_3_8::node_value_converter': use of class template requires template argument list

I verified this by just downloading the standalone header into a project that compiles cleanly and adding the node.hpp file into its source files, then including it.

Reproduction steps

#include <fkYAML/node.hpp>

Expected vs. actual results

I expected it to compile cleanly when merely including the header file(s).

Minimal code example

No response

Error messages

error C2976: 'fkyaml::v0_3_8::node_value_converter': too few template arguments
error C2955: 'fkyaml::v0_3_8::node_value_converter': use of class template requires template argument list

Compiler and operating system

Windows 10, Visual Studios 2022 version 17.10.1

Library version

0.3.8

Validation

@fktn-k
Copy link
Owner

fktn-k commented Jun 8, 2024

@Michael-Lafreniere
Thanks for sharing the issue, but that's weired...
The test like this seems to work correctly.
Can you please share compile options you use for builds (which might make some difference)?

@Michael-Lafreniere
Copy link
Author

The previous project was was compiled with C++20.

I just created a brand new console project using all the default settings. I downloaded https://github.com/fktn-k/fkYAML/blob/develop/single_include/fkYAML/node.hpp directly into the folder and tried to compile it.

node.hpp(8668,9): error C2976: 'fkyaml::v0_3_8::node_value_converter': too few template arguments
node.hpp(8668,27): error C2955: 'fkyaml::v0_3_8::node_value_converter': use of class template requires template argument list

Unless I'm missing something big here? The single header should work standalone without having to clone the project correct (I want the whole thing I'm just testing right now since mine worked fine 3 days ago, but when I updated it broke.)

@fktn-k
Copy link
Owner

fktn-k commented Jun 9, 2024

@Michael-Lafreniere
As you mentioned, the single header should work if it's compiled with C++11 or newer.
Thanks to your additional information mentioned C++ standard, however, I've realized that Windows builds with C++20 haven't been tested both in my local environment and the GitHub Actions workflows.
So I tested builds with Visual Studio 2022 and C++20 and the reported errors are related to building fkYAML with C++20 (and newer).

Although I can't tell what the root cause is, building fkYAML on Windows with C++20 or newer somehow ignores the default template parameter for node_value_converter and the compiler emits the errors.
So I've made a quick fix in this branch for the errors as well as some other warniings when compiled with C++17 or older without the /permissive- flag.
Can you download and use this standalone node.hpp file to check if the errors are resolved?

@Michael-Lafreniere
Copy link
Author

Yes, that fixed it in both the quick test I put together and my other two projects. Awesome work and thank you for the fast replies!

@fktn-k
Copy link
Owner

fktn-k commented Jun 9, 2024

@Michael-Lafreniere
Thanks for the confirmation.
FYI, I just merged the branch I shared above into develop.

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

No branches or pull requests

2 participants