Skip to content

Commit

Permalink
[NFC] Fix builds on recent GCC with C++20 enabled
Browse files Browse the repository at this point in the history
The following pattern fails on recent GCC versions with -std=c++20 flag passed
and succeeds with -std=c++17. Such behavior is not observed on Clang 16.0.

```c++
template <typename T>
struct Foo {
    Foo<T>(int a) {}
};
```

This patch removes template parameter from constructor in two occurences to
make the following command complete successfully:
bazel build -c fastbuild --cxxopt=-std=c++20 --host_cxxopt=-std=c++20 @llvm-project//llvm/...

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D154782
  • Loading branch information
alexbatashev committed Jul 18, 2023
1 parent e6b98b7 commit 17508cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions llvm/include/llvm/CodeGen/ByteProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ namespace llvm {
/// are used to extract Bytes.
template <typename ISelOp> class ByteProvider {
private:
ByteProvider<ISelOp>(std::optional<ISelOp> Src, int64_t DestOffset,
int64_t SrcOffset)
ByteProvider(std::optional<ISelOp> Src, int64_t DestOffset, int64_t SrcOffset)
: Src(Src), DestOffset(DestOffset), SrcOffset(SrcOffset) {}

// TODO -- use constraint in c++20
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3472,8 +3472,7 @@ template <typename BaseTy, typename ToTy>
struct CachedReachabilityAA : public BaseTy {
using RQITy = ReachabilityQueryInfo<ToTy>;

CachedReachabilityAA<BaseTy, ToTy>(const IRPosition &IRP, Attributor &A)
: BaseTy(IRP, A) {}
CachedReachabilityAA(const IRPosition &IRP, Attributor &A) : BaseTy(IRP, A) {}

/// See AbstractAttribute::isQueryAA.
bool isQueryAA() const override { return true; }
Expand Down

0 comments on commit 17508cb

Please sign in to comment.