daphne-eu / daphne

DAPHNE: An Open and Extensible System Infrastructure for Integrated Data Analysis Pipelines
Apache License 2.0
67 stars 59 forks source link

Compilation with Clang #830

Open corepointer opened 1 month ago

corepointer commented 1 month ago

At the moment, compiling with clang fails at least for me. Errors start with this:

/daphne/src/parser/daphnedsl/DaphneDSLVisitor.cpp:1487:51: error: 'auto' not allowed in template argument                                                                                                                                                  
 1487 |                        int64_t i, std::pair<bool, auto> constValue) {                                                
      |                                                   ^~~~                                                                                                                                                                                             
/daphne/src/parser/daphnedsl/DaphneDSLVisitor.cpp:1508:21: error: no matching function for call to object of type '(lambda at /daphne/src/parser/daphnedsl/DaphneDSLVisitor.cpp:1486:20)'                                                                  
 1508 |                     fillRes(i,                      
      |                     ^~~~~~~                                                                                          
/daphne/src/parser/daphnedsl/DaphneDSLVisitor.cpp:1658:47: note: in instantiation of function template specialization 'DaphneDSLVisitor::buildColMatrixFromValues<long>' requested here                                                                    
 1658 |                 colMatrix = DaphneDSLVisitor::buildColMatrixFromValues<int64_t>(                                                                                                                                                                   
      |                                               ^                                                                                                                                                                                                    
/daphne/src/parser/daphnedsl/DaphneDSLVisitor.cpp:1486:20: note: candidate function not viable: no known conversion from 'std::pair<bool, long>' to 'int' for 2nd argument
 1486 |     auto fillRes = [&constValues, &nonConstValsIdx](                                                                                                                                                                                               
      |                    ^                                                                                                                                                                                                                               
 1487 |                        int64_t i, std::pair<bool, auto> constValue) {                                                                                                                                                                              
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   

This goes on until it stops with

fatal error: too many errors emitted, stopping now [-ferror-limit=]                                                          

Clang version in the daphne-dev Docker container is the default of Ubuntu 24:

@daphne-container:/daphne$ clang -v
Ubuntu clang version 18.1.3 (1ubuntu1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /bin
Found candidate GCC installation: /bin/../lib/gcc/x86_64-linux-gnu/13
Selected GCC installation: /bin/../lib/gcc/x86_64-linux-gnu/13
Candidate multilib: .;@m64
Selected multilib: .;@m64
corepointer commented 1 month ago

From what I found out here, the issue described above is that the use of auto as a parameter of std::pair is only working in gcc and actually ill formed.

corepointer commented 1 month ago

@philipportner I fixed this issue and it's compiling (with loads of warnings though).