Commit c1d34f90 by Jason Merrill

re PR c++/13092 (Accepts invalid pointer-to-member conversion)

        PR c++/13092
        * init.c (build_offset_ref): Build SCOPE_REF with non-null
        TREE_TYPE for non-dependent names.
        * pt.c (type_dependent_expression_p): Handle SCOPE_REF with
        unknown_type_node as its TREE_TYPE.
        * cxx-pretty_print.c (pp_cxx_unqualified_id): Handle BASELINK.
        * error.c (dump_decl) <SCOPE_REF case>: Use pp_expression.
        (dump_expr) <SCOPE_REF case>: Likewise.

From-SVN: r82553
parent 3ff2f9d1
// { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo@libero.it>
// Two-phase name lookup for address of member:
// Detecting error during parsing
struct S
{
char i;
};
template<int S::*p>
struct X
{};
template <class T>
struct Foo
{
X<&S::i> x; // { dg-error "convert|no type" }
};
// { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo@libero.it>
// Two-phase name lookup for address of member:
// Overloading function
struct S
{
int f();
int f(int);
};
template<int (S::*p)()>
struct X
{};
template <class T>
struct Foo
{
X<&S::f> x;
};
// { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo@libero.it>
// Two-phase name lookup for address of member:
// Detecting overloading function error during parsing
struct S
{
int f(char);
int f(int);
};
template<int (S::*p)()>
struct X
{};
template <class T>
struct Foo
{
X<&S::f> x; // { dg-error "convert|no type" }
};
// { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo@libero.it>
// PR c++/13092: ICE taking address of member which is non-dependent
struct S
{
int i;
};
template<int S::*p>
struct X
{};
template <class T>
struct Foo
{
X<&S::i> x;
};
template struct Foo<void>;
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