From b3c7a7e98825a788bcbdfc0add2f3be7d0d18e15 Mon Sep 17 00:00:00 2001 From: Alexander Kornienko Date: Mon, 24 Mar 2025 16:45:45 +0100 Subject: [PATCH] Fix a compilation error with a recent Clang (#5170) This fixes a `copy constructor must pass its first argument by reference` compilation error when compiled with a recent enough Clang (after https://github.com/llvm/llvm-project/commit/fe0d3e3764961b62f43f1b129f30aaec5f30bc16, targeted for LLVM 21 release). ``` carbon/lang/common/set.h:81:59: error: copy constructor must pass its first argument by reference 81 | SetView(SetView, KeyContextT> other_view) | ^ ``` --- common/set.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/set.h b/common/set.h index f2e325abfb01..3b01b5a3027c 100644 --- a/common/set.h +++ b/common/set.h @@ -6,6 +6,7 @@ #define CARBON_COMMON_SET_H_ #include +#include #include "common/check.h" #include "common/hashtable_key_context.h" @@ -78,7 +79,7 @@ class SetView : RawHashtable::ViewImpl { // Enable implicit conversions that add `const`-ness to the key type. // NOLINTNEXTLINE(google-explicit-constructor) - SetView(SetView, KeyContextT> other_view) + SetView(const SetView, KeyContextT>& other_view) requires(!std::same_as>) : ImplT(other_view) {}