<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61611>61611</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Build failed with CMAKE_CXX_STANDARD=20
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
wangzw
</td>
</tr>
</table>
<pre>
Building with `CMAKE_CXX_STANDARD=20` failed but with `CMAKE_CXX_STANDARD=17` success
```
gcc --version
gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
uname -a
Linux be52cec1e796 5.15.49-linuxkit #1 SMP Tue Sep 13 07:51:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
```
Cmake configure:
```
cmake ../llvm -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=20
```
Error message:
```
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:3499:38: error: expected unqualified-id before ‘const’
3499 | CachedReachabilityAA<BaseTy, ToTy>(const IRPosition &IRP, Attributor &A)
| ^~~~~
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:3499:38: error: expected ‘)’ before ‘const’
3499 | CachedReachabilityAA<BaseTy, ToTy>(const IRPosition &IRP, Attributor &A)
| ~^~~~~
| )
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp: In constructor ‘{anonymous}::AAIntraFnReachabilityFunction::AAIntraFnReachabilityFunction(const llvm::IRPosition&, llvm::Attributor&)’:
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:3604:20: error: no matching function for call to ‘{anonymous}::CachedReachabilityAA<llvm::AAIntraFnReachability, llvm::Instruction>::CachedReachabilityAA(const llvm::IRPosition&, llvm::Attributor&)’
3604 | : Base(IRP, A) {}
| ^
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:3496:8: note: candidate: ‘{anonymous}::CachedReachabilityAA<llvm::AAIntraFnReachability, llvm::Instruction>::CachedReachabilityAA(const {anonymous}::CachedReachabilityAA<llvm::AAIntraFnReachability, llvm::Instruction>&)’
3496 | struct CachedReachabilityAA : public BaseTy {
| ^~~~~~~~~~~~~~~~~~~~
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:3496:8: note: candidate expects 1 argument, 2 provided
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:3496:8: note: candidate: ‘{anonymous}::CachedReachabilityAA<llvm::AAIntraFnReachability, llvm::Instruction>::CachedReachabilityAA({anonymous}::CachedReachabilityAA<llvm::AAIntraFnReachability, llvm::Instruction>&&)’
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:3496:8: note: candidate expects 1 argument, 2 provided
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp: In lambda function:
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:7594:9: warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]
7594 | [=](const Attributor::ArgumentReplacementInfo &ARI,
| ^
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:7594:9: note: add explicit ‘this’ or ‘*this’ capture
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp: In lambda function:
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:7618:9: warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]
7618 | [=, &AlignAA](const Attributor::ArgumentReplacementInfo &ARI,
| ^
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:7618:9: note: add explicit ‘this’ or ‘*this’ capture
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp: In constructor ‘{anonymous}::AAInterFnReachabilityFunction::AAInterFnReachabilityFunction(const llvm::IRPosition&, llvm::Attributor&)’:
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:10543:69: error: no matching function for call to ‘{anonymous}::CachedReachabilityAA<llvm::AAInterFnReachability, llvm::Function>::CachedReachabilityAA(const llvm::IRPosition&, llvm::Attributor&)’
10543 | : CachedReachabilityAA<AAInterFnReachability, Function>(IRP, A) {}
| ^
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:3496:8: note: candidate: ‘{anonymous}::CachedReachabilityAA<llvm::AAInterFnReachability, llvm::Function>::CachedReachabilityAA(const {anonymous}::CachedReachabilityAA<llvm::AAInterFnReachability, llvm::Function>&)’
3496 | struct CachedReachabilityAA : public BaseTy {
| ^~~~~~~~~~~~~~~~~~~~
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:3496:8: note: candidate expects 1 argument, 2 provided
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:3496:8: note: candidate: ‘{anonymous}::CachedReachabilityAA<llvm::AAInterFnReachability, llvm::Function>::CachedReachabilityAA({anonymous}::CachedReachabilityAA<llvm::AAInterFnReachability, llvm::Function>&&)’
/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:3496:8: note: candidate expects 1 argument, 2 provided
[ 65%] Building CXX object lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/DeadArgumentElimination.cpp.o
make[2]: *** [lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/build.make:132: lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/AttributorAttributes.cpp.o] Error 1
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWU1z4jwS_jXi0oXLlrHBBw7GwAy1-aAI2c2cUrIsQBsjsZKcDHvIb9-SbWLIwmRmKkNN5n1dqfijW63W04_UakS05kvBWB8FAxQMW6QwK6n6T0Qs__vUSmW27Q8KnmdcLOGJmxWg0E0u43-M7pO7u_ubeXw1jGdD5A-xi0IX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