From b00d77eac8f685109dd51b6c801acbc1c1efb1b5 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Mon, 14 Nov 2022 10:38:36 -0500 Subject: [PATCH] LibCore: Invoke `forward` from the global namespace inside C_OBJECT If a class defines a method named `forward` itself, the compiler isn't able to differentiate between that method and (std::)forward. --- Userland/Libraries/LibCore/Object.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Userland/Libraries/LibCore/Object.h b/Userland/Libraries/LibCore/Object.h index 69c3203e340..fd662f363e6 100644 --- a/Userland/Libraries/LibCore/Object.h +++ b/Userland/Libraries/LibCore/Object.h @@ -65,18 +65,18 @@ enum class TimerShouldFireWhenNotVisible { Yes }; -#define C_OBJECT(klass) \ -public: \ - virtual StringView class_name() const override { return #klass##sv; } \ - template \ - static NonnullRefPtr construct(Args&&... args) \ - { \ - return adopt_ref(*new Klass(forward(args)...)); \ - } \ - template \ - static ErrorOr> try_create(Args&&... args) \ - { \ - return adopt_nonnull_ref_or_enomem(new (nothrow) Klass(forward(args)...)); \ +#define C_OBJECT(klass) \ +public: \ + virtual StringView class_name() const override { return #klass##sv; } \ + template \ + static NonnullRefPtr construct(Args&&... args) \ + { \ + return adopt_ref(*new Klass(::forward(args)...)); \ + } \ + template \ + static ErrorOr> try_create(Args&&... args) \ + { \ + return adopt_nonnull_ref_or_enomem(new (nothrow) Klass(::forward(args)...)); \ } #define C_OBJECT_ABSTRACT(klass) \