mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 21:30:12 +01:00
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<std::remove_const_t<KeyT>, KeyContextT> other_view) | ^ ```
This commit is contained in:
+2
-1
@@ -6,6 +6,7 @@
|
||||
#define CARBON_COMMON_SET_H_
|
||||
|
||||
#include <concepts>
|
||||
#include <type_traits>
|
||||
|
||||
#include "common/check.h"
|
||||
#include "common/hashtable_key_context.h"
|
||||
@@ -78,7 +79,7 @@ class SetView : RawHashtable::ViewImpl<InputKeyT, void, InputKeyContextT> {
|
||||
|
||||
// Enable implicit conversions that add `const`-ness to the key type.
|
||||
// NOLINTNEXTLINE(google-explicit-constructor)
|
||||
SetView(SetView<std::remove_const_t<KeyT>, KeyContextT> other_view)
|
||||
SetView(const SetView<std::remove_const_t<KeyT>, KeyContextT>& other_view)
|
||||
requires(!std::same_as<KeyT, std::remove_const_t<KeyT>>)
|
||||
: ImplT(other_view) {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user