C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Public inheritance with banned conversion to base

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Thu, 23 Jan 2025 23:05:56 +0000
On Thu, Jan 23, 2025 at 1:22 PM Giuseppe D'Angelo wrote:
>
> (I'm unsure if this extends to things like std::bind's return type,
> since by specification, it's unspecified.)


I was surprised to see that the following works on g++, clang,
Microsoft. It fails on the Intel compiler.

    auto Func(void)
    {
        return [](int const a){ return a * 3; };
    }

    typedef decltype(Func()) Lambda;

    class MyClass : public Lambda {

    };

    int main(void)
    {
        MyClass obj;
    }

Received on 2025-01-23 23:06:08