Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

Initialisation of for-loop variable using string literal

$
0
0

Hi,

I've recently encountered a compiler error using the Intel compiler using the following code:

inline unsigned long long operator""_abc(const unsigned long long value)
{
    return value;
}

int main()
{
    auto a = 0_abc;
    for (; a < 2_abc; ++a)
    {
    }

    for (auto b = 0_abc; b < 2_abc; ++b)
    {
    }

    return 0;
}

The compiler error I get is 

1>C:\Users\dkoschier\Dev\StringLiteral\StringLiteral\main.cpp(14): error : user-defined literal operator not found
1>      for (auto b = 0_abc; b < 2_abc; ++b)
 

The first for-loop happily compiles while the initialisation in the second one doesn't. I genuinely believe this is a bug in the compiler.

Does anyone know of a way to fix this problem? 

EDIT: Occured using Intel® C++ Compiler 18.0 in Windows 10

TCE Open Date: 

Thursday, December 19, 2019 - 06:46

Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>