Indiana Unversity logo[ConceptGCC]

ConceptGCC :

variadic templates and concepts

From: Sylvain Pion (Sylvain.Pion_at_[hidden])
Date: 2007-11-19 13:42:31


Dear all,

I am working on specifying an extension of std::min() to a variable
number of arguments using variadic templates. For the concept-enabled
version, I need to define a concept that constrains all arguments
to be of the same type. That is, an extension of std::SameType to the
variadic case.

I am stuck with a problem using conceptgcc, which I fear is a bug,
or maybe a misunderstanding on my side. A reduced test-case is below,
which generates the following error message:

bug_report.cpp: In function 'const T& f(const T&, const T&, const Args&
...)':
bug_report.cpp:23: error: no matching function for call to 'f(const T&,
#'type_pack_expansion' not supported by
dump_type_prefix#<typeprefixerror>&#'type_pack_expansion' not supported
by dump_type_suffix#)'

------------------------------
concept SameType <typename T, typename... Args> {}

template <typename T>
concept_map SameType<T> {}

template <typename T>
concept_map SameType<T, T> {}

template <typename T, typename... Args>
requires SameType<T, Args...>
concept_map SameType<T, T, Args...> {}

template <typename T>
const T&
f(const T&a)
{ return a; }

template <typename T, typename... Args>
requires SameType<T, Args...>
const T&
f(const T&a, const T&b, const Args&... args)
{ return f(a, args...); }
------------------------------

Is there any way to fix this?

-- 
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/