// { dg-do assemble }
|
// { dg-do assemble }
|
// All the pointer_to_binary_function cases used to fail because g++
|
// All the pointer_to_binary_function cases used to fail because g++
|
// couldn't handle converting an overloaded function to a class type.
|
// couldn't handle converting an overloaded function to a class type.
|
// The first one should still fail because it requires an implicit conversion
|
// The first one should still fail because it requires an implicit conversion
|
// to pointer_to_binary_function, which has an `explicit' constructor.
|
// to pointer_to_binary_function, which has an `explicit' constructor.
|
|
|
#include
|
#include
|
#include
|
#include
|
#include
|
#include
|
|
|
using namespace std;
|
using namespace std;
|
|
|
template class Expr
|
template class Expr
|
{
|
{
|
public :
|
public :
|
Expr(){};
|
Expr(){};
|
Expr(const T&){};
|
Expr(const T&){};
|
};
|
};
|
|
|
template
|
template
|
inline bool compare(const Expr a, const Expr b){ return true; }
|
inline bool compare(const Expr a, const Expr b){ return true; }
|
|
|
int main()
|
int main()
|
{
|
{
|
vector a(3);
|
vector a(3);
|
sort( a.begin(), a.end(),
|
sort( a.begin(), a.end(),
|
static_cast,const Expr)>(compare) );
|
static_cast,const Expr)>(compare) );
|
sort( a.begin(), a.end(), compare );
|
sort( a.begin(), a.end(), compare );
|
sort::iterator,
|
sort::iterator,
|
pointer_to_binary_function, const Expr, bool> >
|
pointer_to_binary_function, const Expr, bool> >
|
( a.begin(), a.end(), compare ); // { dg-error "" } constructor is explicit
|
( a.begin(), a.end(), compare ); // { dg-error "" } constructor is explicit
|
sort( a.begin(), a.end(),
|
sort( a.begin(), a.end(),
|
ptr_fun, const Expr, bool> (compare) );
|
ptr_fun, const Expr, bool> (compare) );
|
sort( a.begin(), a.end(),
|
sort( a.begin(), a.end(),
|
ptr_fun(compare) );
|
ptr_fun(compare) );
|
sort( a.begin(), a.end(),
|
sort( a.begin(), a.end(),
|
pointer_to_binary_function, const Expr, bool>(compare) );
|
pointer_to_binary_function, const Expr, bool>(compare) );
|
sort( a.begin(), a.end(),
|
sort( a.begin(), a.end(),
|
pointer_to_binary_function, const Expr, bool>(compare) );
|
pointer_to_binary_function, const Expr, bool>(compare) );
|
sort( a.begin(), a.end(),
|
sort( a.begin(), a.end(),
|
pointer_to_binary_function, const Expr, bool>(compare<>) );
|
pointer_to_binary_function, const Expr, bool>(compare<>) );
|
}
|
}
|
|
|