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

[MSVC] Compile error in StringView.h with c++20 or later #655

Closed
NEIL-smtg opened this issue Aug 27, 2024 · 1 comment
Closed

[MSVC] Compile error in StringView.h with c++20 or later #655

NEIL-smtg opened this issue Aug 27, 2024 · 1 comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@NEIL-smtg
Copy link

Describe the bug

I work on MSVC compiler testing, and we regularly build popular open-source project, with development builds of MSVC in order to find and fix regressions.

Recently, when we are building OSQuery, which used aws-crt-cpp as one of its libraries, it encountered error C3878 and C2760 in StringView.h L861:

Note: OSQuery is using c2d6ffa, which is a commit from 3 years ago. Hence the line that causing error might be different with the latest commit.

Expected Behavior

It compiles

Current Behavior

C:\gitP\facebook\osquery\libraries\cmake\source\aws-sdk-cpp\src\aws-crt-cpp\include\aws/crt/StringView.h(856): error C3878: syntax error: unexpected token ',' following 'simple-type-specifier'
C:\gitP\facebook\osquery\libraries\cmake\source\aws-sdk-cpp\src\aws-crt-cpp\include\aws/crt/StringView.h(856): note: missing one of: ( { ?
C:\gitP\facebook\osquery\libraries\cmake\source\aws-sdk-cpp\src\aws-crt-cpp\include\aws/crt/StringView.h(856): error C3878: syntax error: unexpected token ',' following 'simple-declaration'
C:\gitP\facebook\osquery\libraries\cmake\source\aws-sdk-cpp\src\aws-crt-cpp\include\aws/crt/StringView.h(856): note: error recovery skipped: ','
C:\gitP\facebook\osquery\libraries\cmake\source\aws-sdk-cpp\src\aws-crt-cpp\include\aws/crt/StringView.h(856): error C2760: syntax error: '>' was unexpected here; expected 'declaration'
C:\gitP\facebook\osquery\libraries\cmake\source\aws-sdk-cpp\src\aws-crt-cpp\include\aws/crt/StringView.h(857): error C3878: syntax error: unexpected token ',' following 'simple-type-specifier'
C:\gitP\facebook\osquery\libraries\cmake\source\aws-sdk-cpp\src\aws-crt-cpp\include\aws/crt/StringView.h(857): note: missing one of: ( { ?
C:\gitP\facebook\osquery\libraries\cmake\source\aws-sdk-cpp\src\aws-crt-cpp\include\aws/crt/StringView.h(857): error C2760: syntax error: ',' was unexpected here; expected ';'
C:\gitP\facebook\osquery\libraries\cmake\source\aws-sdk-cpp\src\aws-crt-cpp\include\aws/crt/StringView.h(857): error C3878: syntax error: unexpected token ',' following 'jump-statement'
C:\gitP\facebook\osquery\libraries\cmake\source\aws-sdk-cpp\src\aws-crt-cpp\include\aws/crt/StringView.h(857): note: error recovery skipped: ','
C:\gitP\facebook\osquery\libraries\cmake\source\aws-sdk-cpp\src\aws-crt-cpp\include\aws/crt/StringView.h(857): error C2760: syntax error: '>>' was unexpected here; expected 'declaration'
C:\gitP\facebook\osquery\libraries\cmake\source\aws-sdk-cpp\src\aws-crt-cpp\include\aws/crt/StringView.h(857): error C2760: syntax error: ')' was unexpected here; expected 'expression'
C:\gitP\facebook\osquery\libraries\cmake\source\aws-sdk-cpp\src\aws-crt-cpp\include\aws/crt/StringView.h(857): error C2760: syntax error: ')' was unexpected here; expected ';'
C:\gitP\facebook\osquery\libraries\cmake\source\aws-sdk-cpp\src\aws-crt-cpp\include\aws/crt/StringView.h(857): error C3878: syntax error: unexpected token ')' following 'expression-statement'
C:\gitP\facebook\osquery\libraries\cmake\source\aws-sdk-cpp\src\aws-crt-cpp\include\aws/crt/StringView.h(857): note: error recovery skipped: ')'

Reproduction Steps

  1. Download the preprocessed file: Api.txt
  2. Open x64 Native Windows Command prompt
  3. CL /c /TP /EHsc /std:c++20 Api.txt

Possible Solution

No response

Additional Information/Context

OSQuery build log: os.log

aws-crt-cpp version used

.

Compiler and version used

MSVC 19.42.34325.97

Operating System and version

Windows 11

@NEIL-smtg NEIL-smtg added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 27, 2024
@graebm
Copy link
Contributor

graebm commented Sep 3, 2024

Fixed by #659

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants