Skip to content

Instantly share code, notes, and snippets.

@marzer
Last active November 25, 2019 11:45
Show Gist options
  • Save marzer/54a2d40fc144393b47c78804452a7300 to your computer and use it in GitHub Desktop.
Save marzer/54a2d40fc144393b47c78804452a7300 to your computer and use it in GitHub Desktop.
//_MSC_VER: 1923
//_MSC_FULL_VER: 192328107
//Toolset: v142
//Visual studio: 2019 16.3.10
//compiler flags: /std:c++latest /permissive-
#include <string_view>
[[deprecated]]
constexpr std::string_view Test(const char* str, size_t len) noexcept
{
return std::string_view{ str, len };
}
int main()
{
constexpr auto test1 = Test("fff", 3); //does NOT issue a deprecation warning
const auto test2 = Test("fff", 3); //correctly issues a deprecation warning
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment