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

            Bug ID: 69178
           Summary: [concepts] An invalid expression in a
                    requires-expression is evaluated too eagerly
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ville.voutilainen at gmail dot com
  Target Milestone: ---

Test snippet:

template <class T> struct S : T {};
template <class T> concept bool ConcreteDerivableFrom()
{
    return requires()
    {
        S<T>();
    };
}

struct X final {};

template <ConcreteDerivableFrom C>
void f() {}

template <class T>
void f() {}

int main()
{
    f<X>();
}

Fails with

prog.cc: In instantiation of 'struct S<X>':
prog.cc:20:10:   required from here
prog.cc:1:27: error: cannot derive from 'final' base 'X' in derived type 'S<X>'
 template <class T> struct S : T {};
                           ^

Reply via email to