This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug driver/85493] decltype can use deleted constructor and deleted function in template function


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85493

Ihor Rudynskyi <ihorelo at mail dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|decltype can use deleted    |decltype can use deleted
                   |constructor in template     |constructor and deleted
                   |function                    |function in template
                   |                            |function

--- Comment #1 from Ihor Rudynskyi <ihorelo at mail dot ru> ---
also doesn`t work with deleted template function

template<typename...>
int foo() = delete;

template<typename...>
void test()
{
        decltype(foo<int>()) a{};
}

int main()
{
        test<>();
}(In reply to Ihor Rudynskyi from comment #0)
> decltype can use deleted constructor in template function
> 
> struct no_def
> {
>     no_def() = delete;
> };
> 
> template<typename T>
> void test()
> {
>     decltype(no_def()) a{}; // error in Clang and MSVC, no error in GCC
>     a = a; // get rid of warning
> }
> 
> int main()
> {
>     test<int>();
> }
> 
> 
> Please check
> https://stackoverflow.com/questions/49965849/decltype-with-deleted-
> constructor-is-possible-in-template-function

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]