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

Fix use-out-of-constexpr lifetime detected by prerelease MSVC #1312

Merged
merged 1 commit into from
Dec 23, 2023

Conversation

BillyONeal
Copy link
Member

@BillyONeal BillyONeal commented Dec 21, 2023

commands.build.cpp

E:\Repro\RWC\vcpkg_tool_repro\vcpkg-tool\src\vcpkg\commands.build.cpp(1498,68): error C7595: 'fmt::v10::basic_format_string<char,const std::string &>::basic_format_string': call to immediate function is not a constant expression

E:\Repro\RWC\vcpkg_tool_repro\vcpkg-tool\include\vcpkg\base\stringview.h(33,62): note: failure was caused by a read of a variable outside its lifetime

E:\Repro\RWC\vcpkg_tool_repro\vcpkg-tool\include\vcpkg\base\stringview.h(33,62): note: see usage of 'details_start'

E:\Repro\RWC\vcpkg_tool_repro\vcpkg-tool\src\vcpkg\commands.build.cpp(1498,68): note: the call stack of the evaluation (the oldest call first) is

E:\Repro\RWC\vcpkg_tool_repro\vcpkg-tool\src\vcpkg\commands.build.cpp(1498,68): note: while evaluating function 'const char *vcpkg::ZStringView::c_str(void) noexcept const'

E:\Repro\RWC\vcpkg_tool_repro\vcpkg-tool\include\vcpkg\base\stringview.h(85,67): note: while evaluating function 'const char *vcpkg::StringView::data(void) noexcept const'

This was originally reported by @Zhaojun-Liu of Beyondsoft . This fix was suggested by @joemmett of the compiler frontend team.

```console
commands.build.cpp

E:\Repro\RWC\vcpkg_tool_repro\vcpkg-tool\src\vcpkg\commands.build.cpp(1498,68): error C7595: 'fmt::v10::basic_format_string<char,const std::string &>::basic_format_string': call to immediate function is not a constant expression

E:\Repro\RWC\vcpkg_tool_repro\vcpkg-tool\include\vcpkg\base\stringview.h(33,62): note: failure was caused by a read of a variable outside its lifetime

E:\Repro\RWC\vcpkg_tool_repro\vcpkg-tool\include\vcpkg\base\stringview.h(33,62): note: see usage of 'details_start'

E:\Repro\RWC\vcpkg_tool_repro\vcpkg-tool\src\vcpkg\commands.build.cpp(1498,68): note: the call stack of the evaluation (the oldest call first) is

E:\Repro\RWC\vcpkg_tool_repro\vcpkg-tool\src\vcpkg\commands.build.cpp(1498,68): note: while evaluating function 'const char *vcpkg::ZStringView::c_str(void) noexcept const'

E:\Repro\RWC\vcpkg_tool_repro\vcpkg-tool\include\vcpkg\base\stringview.h(85,67): note: while evaluating function 'const char *vcpkg::StringView::data(void) noexcept const'
```

This was originally reported by June Liu of Beyondsoft
@BillyONeal BillyONeal merged commit 5b8f9c4 into microsoft:main Dec 23, 2023
5 checks passed
@BillyONeal BillyONeal deleted the constexpr-fix branch December 23, 2023 08:58
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.

2 participants