Indiana Unversity logo[ConceptGCC]

ConceptGCC :

question about CopyConstructible

From: Martin Sebor (sebor_at_[hidden])
Date: 2007-02-20 19:53:16


I'm playing for the first time with conceptgcc and have
a question about the CopyConstructible concept that might
just be a reflection of a misunderstanding on my part. Is
the concept intended to match the core language notion of
copy constructibility? I.e., does a type whose copy ctor
takes its argument by non-const reference satisfy the
concept? I ask because I get an error from the alpha-4
compiler (see below). I also note that gcc defines the
concept slightly differently than N2042 (the paper has
T::T(T) while gcc has T::T(const T&) although swapping
one for the other didn't make a difference)

Martin

$ cat t.cpp && g++ t.cpp
#include <concepts>

template <std::CopyConstructible T> void bar (T*) { }

struct S { S (S&); };

int main ()
{
     bar ((S*)0);
}
t.cpp: In function 'int main()':
t.cpp:9: error: no matching function for call to 'bar(S*)'
t.cpp:3: note: candidates are: void bar(T*) [with T = S] <where clause>
t.cpp:9: note: no concept map for requirement 'std::CopyConstructible<S>'