Commit 84bafc8d by Douglas Gregor Committed by Paolo Carlini

cv_func.C: New test.

2005-02-21  Douglas Gregor  <dgregor@cs.indiana.edu>

        * g++.dg/other/cv_func.C: New test.
        * g++.dg/template/mem_func_ptr.C: New test.
        * g++.dg/template/qualttp20.C: We now get the xfail'd warning
        when we are being pedantic; we expect this test to pass now.
        * g++.old-deja/g++.pt/ptrmem5.C: We no longer receive a bogus
        error here.

From-SVN: r95357
parent 9804209d
// { dg-do compile }
// { dg-options "-pedantic -pedantic-errors" }
typedef int FIC(int) const;
typedef int FI(int);
FIC f; // { dg-error "qualified" }
// { dg-error "ignoring" "" { target *-*-* } 6 }
struct S {
FIC f; // OK
const FI g; // { dg-error "qualifier" }
int h(int) const;
};
FIC S::*pm = &S::f;
const FI S::*pm2 = &S::f; // { dg-error "qualifier" }
// { dg-error "cannot convert" "" { target *-*-* } 17 }
const FIC S::*pm3 = &S::f; // { dg-error "qualifier" }
int S::f(int) const
{
return 17;
}
int foo(float) const // { dg-error "qualifier" }
{
return 0;
}
int bar(float) volatile; // { dg-error "qualifier" }
// { dg-do compile }
template<typename T> struct takes_member_ptr;
template<typename T, typename Class> struct takes_member_ptr<T Class::*> {};
template<typename T, typename Class>
void fun_takes_member_ptr(T Class::*) {}
template<typename T> struct order_member_ptrs;
template<typename T, typename Class> struct order_member_ptrs<T Class::*> {};
template<typename R, typename T1, typename Class>
struct order_member_ptrs<R (Class::*)(T1)>
{
typedef int type;
};
template<typename R, typename T1, typename Class>
struct order_member_ptrs<R (Class::*)(T1) const>
{
typedef int c_type;
};
template<typename R, typename T1, typename Class>
struct order_member_ptrs<R (Class::*)(T1) volatile>
{
typedef int v_type;
};
template<typename R, typename T1, typename Class>
struct order_member_ptrs<R (Class::*)(T1) const volatile>
{
typedef int cv_type;
};
struct X {
void bar(float) {}
void bar_c(float) const {}
void bar_v(float) volatile {}
void bar_cv(float) const volatile {}
};
void foo()
{
sizeof(takes_member_ptr<void (X::*)(float)>);
sizeof(takes_member_ptr<void (X::*)(float) const>);
sizeof(takes_member_ptr<void (X::*)(float) volatile>);
sizeof(takes_member_ptr<void (X::*)(float) const volatile>);
sizeof(order_member_ptrs<void (X::*)(float)>::type);
sizeof(order_member_ptrs<void (X::*)(float) const>::c_type);
sizeof(order_member_ptrs<void (X::*)(float) volatile>::v_type);
sizeof(order_member_ptrs<void (X::*)(float) const volatile>::cv_type);
fun_takes_member_ptr(&X::bar);
fun_takes_member_ptr(&X::bar_c);
fun_takes_member_ptr(&X::bar_v);
fun_takes_member_ptr(&X::bar_cv);
}
// { dg-do compile }
// { dg-options "-pedantic -pedantic-errors" }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 15 Dec 2001 <nathan@codesourcery.com>
......@@ -16,7 +17,7 @@ struct AS
template <typename T> struct B1 : T
{
typedef typename T::L __restrict__ r;// { dg-error "'__restrict__' qualifiers cannot" "" }
typedef typename T::myT __restrict__ p;// { dg-warning "ignoring '__restrict__'" "" { xfail *-*-* } }
typedef typename T::myT __restrict__ p;// { dg-error "ignoring '__restrict__'" }
// The following are DR 295 dependent
typedef typename T::myT volatile *myvolatile;
......
......@@ -14,4 +14,4 @@ struct Null {
int *pd = NULL;
int (*pf)() = NULL;
int Null::*pmd = NULL;
int (Null::*pmf)() = NULL; // { dg-bogus "" "" { xfail *-*-* } } - cannot convert -
int (Null::*pmf)() = NULL;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment