DAAL under C++20 does not compile due to DR 2237 #2866
Open
Description
When including the header daal.h
, the program fails to compile when C++20 enabled. This is due to the inclusion of DR 2237 into the standard, which prohibits simple-template-ids in constructors. As a result, certain class constructors are malformed under C++20 and they fail to compile. At the end of the link above, a similar error case is described.
To Reproduce
Steps to reproduce the behavior:
- Assume the following file
#include "daal.h"
int main(){}
- Compile with
g++ --std=c++17
, observe that it compiles without errors. - Compile with
g++ --std=c++20
, observe that multipleexpected unqualified-id before ‘)’ token
errors are thrown for constructors for certain classes.
In file included from /opt/intel/oneapi/dal/2024.5/include/dal/algorithms/linear_regression/linear_regression_training_distributed.h:32,
from /opt/intel/oneapi/dal/latest/include/daal.h:74,
from t.cpp:1:
/opt/intel/oneapi/dal/2024.5/include/dal/algorithms/linear_regression/linear_regression_training_types.h: At global scope:
/opt/intel/oneapi/dal/2024.5/include/dal/algorithms/linear_regression/linear_regression_training_types.h:287:35: error: expected unqualified-id before ‘)’ token
287 | DistributedInput<step2Master>();
| ^
In file included from /opt/intel/oneapi/dal/latest/include/daal.h:74,
from t.cpp:1:
/opt/intel/oneapi/dal/2024.5/include/dal/algorithms/linear_regression/linear_regression_training_distributed.h:148:54: error: expected unqualified-id before ‘)’ token
148 | Distributed<step1Local, algorithmFPType, method>() {}
| ^
In file included from /opt/intel/oneapi/dal/2024.5/include/dal/algorithms/pca/pca_types.h:33,
from /opt/intel/oneapi/dal/latest/include/daal.h:107,
from t.cpp:1:
/opt/intel/oneapi/dal/2024.5/include/dal/algorithms/covariance/covariance_distributed.h:567:54: error: expected unqualified-id before ‘)’ token
567 | Distributed<step1Local, algorithmFPType, method>() : Online<algorithmFPType, method>() {}
| ^
In file included from /opt/intel/oneapi/dal/latest/include/daal.h:230,
from t.cpp:1:
/opt/intel/oneapi/dal/2024.5/include/dal/algorithms/ridge_regression/ridge_regression_training_distributed.h:141:54: error: expected unqualified-id before ‘)’ token
141 | Distributed<step1Local, algorithmFPType, method>() : Online<algorithmFPType, method>() {}
|
Expected behavior
No errors should occur. Interestingly, clang does not throw an error for this case.
Environment:
- OS: Ubuntu 22.04
- Compiler: g++ 11.4.0
- Version: 2024.5
Metadata
Assignees
Labels
No labels