public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94597] New: ICE while using a concept checking for user defined conversion operator
@ 2020-04-14 17:38 barolek at gmail dot com
  2020-04-15  5:31 ` [Bug c++/94597] [10 Regression] ICE while using a concept checking for user defined conversion operator since r10-3735-gcb57504a55015891 marxin at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: barolek at gmail dot com @ 2020-04-14 17:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94597
           Summary: ICE while using a concept checking for user defined
                    conversion operator
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barolek at gmail dot com
  Target Milestone: ---

Hello,

I found this ICE when playing with Godbolt compiler explorer. I don't have
access to system with installed GCC, I can't get preprocessed file (as in
instruction), I will give the source code, that caused the error.

Following snipped caused ICE on GCC, it compiles with Clang, I think (concepts
are new feature and I'm not expert) that this is a valid code which should
accept types with defined user defined conversion operator.

GCC INFO:

COLLECT_GCC=/opt/compiler-explorer/gcc-snapshot/bin/g++

Target: x86_64-linux-gnu

Configured with: ../gcc-trunk-20200414/configure
--prefix=/opt/compiler-explorer/gcc-build/staging --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-bootstrap
--enable-multiarch --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --enable-clocale=gnu --enable-languages=c,c++,fortran,ada,d
--enable-ld=yes --enable-gold=yes --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-linker-build-id --enable-lto
--enable-plugins --enable-threads=posix
--with-pkgversion=Compiler-Explorer-Build

Thread model: posix

Supported LTO compression algorithms: zlib

gcc version 10.0.1 20200413 (experimental) (Compiler-Explorer-Build) 

COMPILER FLAGS: -std=c++2a

SOURCE CODE: (https://godbolt.org/z/33LD8M) (It compiles with clang trunk with
-stdlib=libc++ flag)

#include <concepts>

template<typename From, typename To>
concept has_user_defined_conversion = requires (From f)
{
    f.operator To();
};

template<typename w, typename w2>
requires (has_user_defined_conversion<w, w2>)
        bool equal(w const& x, w2 const& y)
        {
                return x == y;
        }

template <typename T>
struct wrapper
{
    T f;

    wrapper(T a) : f(a) {}

    operator T() const
    {
        return f;
    }
};

bool fun()
{
    wrapper a(2.0f);
    wrapper b(3.0f);

    return equal(a, 3.0f);
}

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-21 15:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-14 17:38 [Bug c++/94597] New: ICE while using a concept checking for user defined conversion operator barolek at gmail dot com
2020-04-15  5:31 ` [Bug c++/94597] [10 Regression] ICE while using a concept checking for user defined conversion operator since r10-3735-gcb57504a55015891 marxin at gcc dot gnu.org
2020-04-17 12:55 ` jakub at gcc dot gnu.org
2020-04-21 12:55 ` ppalka at gcc dot gnu.org
2020-04-21 15:00 ` cvs-commit at gcc dot gnu.org
2020-04-21 15:05 ` ppalka at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).