Skip to content

Crash on 19.10, 20.0, and trunk #148325

@AZero13

Description

@AZero13

https://godbolt.org/z/d5ha1EEj4

change the using WinAPIGLFunc = attribute((ms_abi)) GLFunc; to using WinAPIGLFunc = attribute((ms_abi)) Result (*)(Args...); and it doesnt crash

#include <stdint.h>
#include <utility>

template<class T>
class GLFunctor;

template<class Result, class... Args>
class GLFunctor<Result (Args...)>
{
	using GLFunc = Result (*)(Args...);

public:
	Result operator()(Args... args) const
	{
		using WinAPIGLFunc = __attribute__((ms_abi)) GLFunc;
		return reinterpret_cast<WinAPIGLFunc>(glProc)(std::forward<Args>(args)...);
	}
private:
	GLFunc glProc = nullptr;
};

GLFunctor<void (int pname)> test_functor;

void Test()
{
    test_functor(0);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"crashPrefer [crash-on-valid] or [crash-on-invalid]regression:19Regression in 19 release

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions