- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi! I did not find a better way to report this issue, so I report it here:
Using icpc (ICC) 2021.1.2 20201208 via oneAPI on Ubuntu 20.10 fails to compile the following program:
#include <fstream>
constexpr auto FALSE = false;
template <typename T>
void f() {
if constexpr (FALSE)
std::ofstream{"file"} << "asdf";
}
int main() {
f<int>();
}
<source>(8): error: expected an expression
std::ofstream{"file"} << "asdf";
^
detected during instantiation of "void f<T>() [with T=int]" at line 13
Godbolt: https://godbolt.org/z/7vb1ah6av
The problem does not appear if `f` is not a template, if `FALSE` is `true`, or the ctor of the temporary `ostream` is called using parentheses. I think this is a frontend issue parsing the body of the constexpr if.
I have a more complex case of this happending in my library, so I would be happy if the compiler team could address this. Thank you!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for the complete details and the reproducer.
We are also getting the same error with the ICC Compiler(2021.1.2 20201208), and those errors are very much reproducible. We will look into this issue.
Meanwhile, you can use the ICX Compiler to compile your use-case.
Warm Regards,
Abhishek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've reported this bug to our Front End team.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The version against which you reported your issue is no longer targeted for fixes. Please check out the new versions of Intel oneAPI Toolkits for the latest features.
Regards,
Vidya.
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We are closing this thread for now. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.
Thanks & Regards,
Vidya.

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