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

--- Comment #1 from Ying-Po Liao <yingpo.liao at gmail dot com> ---
The following example shows a Concept applied to the constructor of class A.
The compiler (r223061) will generate internal compiler error if A's subclass C
implements default behaviors of copy/move constructors in which base
constructor forwarding is placed. Note that this example only shows a copy
constructor version. However, it will work for any of these cases:

1) C's copy/move constructors do not forward to base class.
2) C's copy/move constructors are deleted.
3) Concept does not use "decltype()" to check things.

$ svn info

Path: .
Working Copy Root Path:
/Users/liao/Downloads/gcc-branch-c++-concepts/c++-concepts
URL: svn://gcc.gnu.org/svn/gcc/branches/c++-concepts
Relative URL: ^/branches/c++-concepts
Repository Root: svn://gcc.gnu.org/svn/gcc
Repository UUID: 138bc75d-0d04-0410-961f-82ee72b054a4
Revision: 223175
Node Kind: directory
Schedule: normal
Last Changed Author: asutton
Last Changed Rev: 223061
Last Changed Date: 2015-05-12 07:21:04 -0500 (Tue, 12 May 2015)

$ cat main.cpp

#include <iostream>

template <typename R>
  concept bool Concept()
  {
    return requires( R r ) {
      std::begin(r);
      std::end(r);
      requires __is_same_as( 
        decltype(std::begin(r)), decltype(std::end(r)) );
    };
  }

struct A
{
  A() = default;
  A( const A& ) = default;

  template <Concept R>
    explicit A( R&& r )
    {}
};

struct C : A
{
  C() = default;
  C( const C& ) = default;
};

int main()
{
  C c;
  return 0;
}

$ g++ -std=c++1z main.cpp -o main

main.cpp: In substitution of ‘template<class R>  requires
predicate((Concept<R>)()) A::A(R&&)  [with R = const A&]’:
main.cpp:24:8:   required from here
main.cpp:20:14: internal compiler error: in conjoin_constraints, at
cp/constraint.cc:89
     explicit A( R&& r )
              ^

main.cpp:20:14: internal compiler error: Abort trap: 6
g++: internal compiler error: Abort trap: 6 (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Reply via email to