- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is VS version?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Viet,
I’m using VS2017.
Best, Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I still haven't found a solution for this problem. Does maybe anyone know if this problem is fixed in the newest version of the compiler?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are there any options that you used? I couldn't even compile your test program with cl.
C:\Temp>cl t.c /c
Microsoft (R) C/C++ Optimizing Compiler Version 19.23.28105.4 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
t.c
t.c(1): error C2143: syntax error: missing '{' before 'string'
t.c(1): error C2059: syntax error: 'string'
t.c(8): error C2059: syntax error: 'bad suffix on number'
t.c(9): error C2059: syntax error: 'bad suffix on number'
t.c(13): error C2059: syntax error: 'bad suffix on number'
C:\Temp>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, I haven't. Only, at least C++11 support should be enabled.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
C:\Temp>cl t.c /c /std:c++14
Microsoft (R) C/C++ Optimizing Compiler Version 19.23.28105.4 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
t.c
t.c(1): error C2143: syntax error: missing '{' before 'string'
t.c(1): error C2059: syntax error: 'string'
t.c(8): error C2059: syntax error: 'bad suffix on number'
t.c(9): error C2059: syntax error: 'bad suffix on number'
t.c(13): error C2059: syntax error: 'bad suffix on number'
C:\Temp>notepad t.c
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;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Thank you for trying this out.
I suspect it doesn't compile for you, because you have named the source file "t.c". I assume that the compiler then uses the C-compiler instead of the C++ compiler. Could you try renaming the file to "t.cpp" and check again, please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Compiled OK with ICL19.1
C:\Temp>icl t.cpp /std:c++14
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.0.166 Build 20191121
Copyright (C) 1985-2019 Intel Corporation. All rights reserved.
t.cpp
Microsoft (R) Incremental Linker Version 14.23.28105.4
Copyright (C) Microsoft Corporation. All rights reserved.
-out:t.exe
t.obj
C:\Temp>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great. Thank you for testing. In that case I simply need to convince some people to switch to a newer version of the Intel compiler.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page