Skip to content

Conversation

@dranger003
Copy link
Contributor

This PR refactors the nested if-else using switch-case to resolve error C1061 using MSVC.
Note: there is also a temporary workaround provided by Deacon8 here #6096

Fixes #6093

}

return hash;
}
Copy link
Member

Choose a reason for hiding this comment

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

This is C++14 - we support just C++11 (https://stackoverflow.com/questions/45097171/the-body-of-constexpr-function-not-a-return-statement)

Probably, just remove the elses from the if-else chain - this is not performance critical code

@ggerganov ggerganov merged commit 15961ec into ggml-org:master Mar 16, 2024
std::replace(arg.begin(), arg.end(), '_', '-');
}

bool arg_found = false;
Copy link
Member

Choose a reason for hiding this comment

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

Btw, to avoid this arg_found everywhere, we should move this if-chain in a bool function and return early on success

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll submit another PR.

@dranger003 dranger003 deleted the fix-c1061 branch March 21, 2024 15:13
hodlen pushed a commit to hodlen/llama.cpp that referenced this pull request Apr 3, 2024
* Refactor nested if causing error C1061 on MSVC.

* Revert back and remove else's.

* Add flag to track found arguments.
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.

Compilation fails with Cmake on Windows (since #5970): error C1061

2 participants