- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
class Wrapper {
public:
consteval Wrapper(int a) {
if (a == 0) Error("Error");
}
void Error(const char* str) {}
};
void Foo(const Wrapper& wrapper) {
}
int main() {
Foo(0);
}
Example: https://godbolt.org/z/
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for reaching out to us.
As you are using consteval in your source code, if a function or a function template is defined by a consteval specifier then all declarations within that function should contain the same specifier.
As 'wrapper' is specified by consteval specifier in your source code, then the 'Error' function should also be specified by consteval.
Could you please try changing the below line
void Error(const char* str) {}
to
consteval void Error(const char* str) {}
if you still face any issues, please do let us know with a complete error log along with the compiler version that is being used.
Thanks & Regards,
Noorjahan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
the Error function isn't consteval on purpose. With Foo(1) it should compile and with Foo(0) it should produce an error, but of course no segmentation fault. We use it to do some checks for strings during compile time. This is just a rather simplified example to demonstrate the problem. With MSVC, clang, gcc and icx it's working as expected.
You can check it with compiler explorer: https://godbolt.org/z/
icc --version: icc (ICC) 2021.3.0 20210609
Compiler Error Output:
Regards
Beep123
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for providing the details.
We are also able to reproduce the issue from our end.
We are working on it, we will get back to you soon.
Thanks & Regards,
Noorjahan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've reported this bug to our Developer.
Not sure if you are aware, but Intel C++ Classic Compiler will enter "Legacy Product Support" mode signaling the end of regular update.
Please see this article for details. https://www.intel.com/content/www/us/en/developer/articles/technical/adoption-of-llvm-complete-icx.html
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
This problem is fixed in icpc2021.6 (oneAPI2022.2 HPC toolkit). Please upgrade your compiler to this one.
We are going to close this thread.
Thanks,
Viet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,I also meet the same problem even though I upgrade my compiler to oneAPI2022.2. How can I fix this problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
This should be a different issue. However, C++ Classic Compiler will be deprecated in 2023 (https://community.intel.com/t5/Intel-C-Compiler/DEPRECATION-NOTICE-Intel-C-Compiler-Classic/td-p/1412265).
Please try with icx, if the problem still occurs, please create a new thread with a test case for us to investigate.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
the problem isn't really fixed. With icpc2021.6 the compiler is no longer crashing, but compiling the code without any error: https://godbolt.org/z/Mx4YT78zv which is wrong, too.
The correct behaviour would be to generate an error, like icx, clang or gcc: https://godbolt.org/z/Mjaz7joae
Regards
Beep123
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for discover that. I'll report it to the development team.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since Classic compiler will be removed second half of 2023. This issue will not be fixed. Please migrate to icx.
Thanks,
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page