wrong error "Substitution failed with N = <empty>"

After update Resharper C++ 2022.3, Resharper displays error with "Substitution failed with N = <empty>" but VS builds succesfully.

It looks like https://youtrack.jetbrains.com/issue/RSCPP-23950/Wrong-error-Substitution-failed-with-N-empty.

It can be reproduced with the code below.

#include <iostream>
#include <algorithm>

 * Literal class type that wraps a constant expression string.
 * Uses implicit conversion to allow templates to *seemingly* accept constant strings.
template<size_t N>
struct StringLiteral {
    constexpr StringLiteral(const char (&str)[N]) {
        std::copy_n(str, N, value);
    char value[N];

template<StringLiteral lit>
void Print() {
    // The size of the string is available as a constant expression.
    constexpr auto size = sizeof(lit.value);

    // and so is the string's content.
    constexpr auto contents = lit.value;

    std::cout << "Size: " << size << ", Contents: " << contents << std::endl;

int main()
    Print<"literal string">(); // Prints "Size: 15, Contents: literal string"
1 comment
Comment actions Permalink

Thanks for the report!

I believe we've already fixed this issue, the fix should be available in 2023.1.


Please sign in to leave a comment.