- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everyone, I would like to report a bug in the Intel C++ compiler regarding alias templates.
I am attaching a MWE consisting of the following files:
// RFASolver.h #ifndef RFASOLVER_H #define RFASOLVER_H class BioLinearisedSolver { }; template <typename BSP> class RFALinearisedSolver { }; template <template <typename> class RFASolverPolicy, typename BioSolverPolicy> class RFASolver { public: void run(); }; #endif /* end of include guard: RFASOLVER_H */
// RFASolver.cpp #include "RFASolver.h" template <template <typename> class RFASolverPolicy, typename BioSolverPolicy> void RFASolver<RFASolverPolicy, BioSolverPolicy>::run() { } template class RFALinearisedSolver<BioLinearisedSolver>; template class RFASolver<RFALinearisedSolver, BioLinearisedSolver>;
// rfa.cpp #include "RFASolver.h" template <typename T> using RFASolverPolicy = RFALinearisedSolver<T>; int main(int argc, char* argv[]) { RFASolver<RFASolverPolicy, BioLinearisedSolver> rfaSolver; rfaSolver.run(); return 0; }
Now, this code compiles fine with g++, but with icpc version 19.0.1.144, compiling with
icpc -pedantic -std=c++14 -c RFASolver.cpp -o RFASolver.o icpc -pedantic -std=c++14 -c rfa.cpp -o rfa.o icpc -o rfa RFASolver.o rfa.o -pedantic -std=c++14
I get
rfa.cpp:(.text+0x30): undefined reference to `RFASolver<RFASolverPolicy, BioLinearisedSolver>::run()'
However, if I remove the alias template and use its value directly, as in
#include "RFASolver.h" int main(int argc, char* argv[]) { RFASolver<RFALinearisedSolver, BioLinearisedSolver> rfaSolver; rfaSolver.run(); return 0; }
it links fine, meaning the bug seems to be related to the use of an alias template.
I understand users like me cannot report bugs directly, is this correct? Can you please report this bug?
In case this matters, I am compiling on an HPC cluster based on Intel architecture. I tried two different clusters and multiple versions of icpc and the result is always the same.
- Tags:
- CC++
- Development Tools
- General Support
- 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
Hi ,
I have tried to reproduce the issue with the files you have provided and the code ran without any errors with icpc compiler.
The icpc version i have used is icpc (ICC) 19.1 20200117. The bug might have been fixed in the latest version.
Could you provide the icpc versions you have tried with.
Thanks
Prasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We don't find the issue in the latest version of icc . It compiled successfully.
Could you please upgrade your compiler to latest version (19.1) and confirm.
If you have any further issues, please get back to us.
Thanks
Prasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Thanks for reporting the bug.
We are closing this thread as the issue is resolved in the latest version of compiler.
Please raise a new thread if you face any new issues.
Thanks
Prasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Thanks for the confirmation , the issue is fixed in latest version.
Please check when the version gets updated in your systems and reach out to us if you face any issues.
Thanks
Prasanth

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