Hello. I am writing with regards to what I believe to be a conformance deviation in the Intel 19.2 and Intel 2022 DPC++ compilers with regard to the C++17 standard as it relates to Class Template Argument Deduction (CTAD) guides:
Specifically, this in reference to this part of the standard:
Presently, the Intel compiler toolchain only supports CTAD at namespace-level scope. Deduction guides that are given within a nested scope are unrecognizable by the compiler and yields an ambiguous error about the return type of the deduction guide requiring a reference to a class specialization (even though one is given):
Thanks for posting in Intel Communities.
Could you please try using the icx compiler as it works as expected? And also, we didn't face any errors while using the dpcpp compiler for the sample code provided by you. Please find the below commands and screenshot of it:
For ICX compiler: Compiling: icx -std=c++17 -O2 -Wall -Wextra -pedantic sample.cpp ./a.out
For DPCPP compiler: Compiling: dpcpp sample.cpp ./a.out
Could you please try and let us know if you are facing any issues?
Thanks & Regards,
This issue turns out to be a bit more of a bit more complicated than I first realized. As it were, the ICX 2022 compiler is actually bumping up against a different problem than ICC 19.2 (or ICX 2021.5) but oddly, the condition that triggers both defects is the same. I have hopefully produced a bit of sample code that will demonstrate both problems. I will endeavor not to confuse you.
The issue I posted initially (specifically the error, "
You should observe that when OUTER_AS_VARIADIC_TEMPLATE=1, ICC 19.2 will fail with both errors and ICX 2022 will fail with the second one (but not the first). You can workaround the ICX failure by uncommenting the (unnecessary) single argument deduction guide.
When OUTER_AS_VARIADIC_TEMPLATE=0 both compilers should handle this code just fine.
This code compiles correctly in MSVC 2017 and later as well as GCC 12.x (11.x does not) without issue regardless of whether or not the outer type is templated. Moreover, neither MSVC nor GCC require the single-argument deduction guide to deduce the inner type from a single argument as this deduction should be inherently non-ambiguous.
_INTEL_LLVM_COMPILER does not appear to be defined when I build in DPC++ 2022.x. Is there another macro I should be looking at?
This is a known issue and will be fixed in the future update. To workaround you can add __INTEL_LLVM_COMPILER=202110 in your Visual Studio project property, Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions
Yes, it's still on the road map. Developer has not yet closed the case.
This also is captured in LLVM community. We'll wait for community to move on this issue
Since C++Compiler Classic (ICC) is deprecated and will be removed from product release in the second half of 2023, this issue won't be fixed in ICC.
For ICX, this issue is also captured in the LLVM community. Once, the issue is fixed there, then ICX will also be fixed.
Sorry for the inconvenience.
We are going to close this case.