From: Jason Merrill Date: Tue, 1 Jun 2004 15:54:33 +0000 (-0400) Subject: re PR c++/13092 (Accepts invalid pointer-to-member conversion) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c1d34f9050f4a44b52ae4b95a10a1a8d3b42061a;p=gcc.git 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) : Use pp_expression. (dump_expr) : Likewise. From-SVN: r82553 --- diff --git a/gcc/testsuite/g++.dg/template/non-dependent10.C b/gcc/testsuite/g++.dg/template/non-dependent10.C new file mode 100644 index 00000000000..369e137317c --- /dev/null +++ b/gcc/testsuite/g++.dg/template/non-dependent10.C @@ -0,0 +1,21 @@ +// { dg-do compile } + +// Origin: Giovanni Bajo + +// Two-phase name lookup for address of member: +// Detecting error during parsing + +struct S +{ + char i; +}; + +template +struct X +{}; + +template +struct Foo +{ + X<&S::i> x; // { dg-error "convert|no type" } +}; diff --git a/gcc/testsuite/g++.dg/template/non-dependent7.C b/gcc/testsuite/g++.dg/template/non-dependent7.C new file mode 100644 index 00000000000..c046312d558 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/non-dependent7.C @@ -0,0 +1,22 @@ +// { dg-do compile } + +// Origin: Giovanni Bajo + +// Two-phase name lookup for address of member: +// Overloading function + +struct S +{ + int f(); + int f(int); +}; + +template +struct X +{}; + +template +struct Foo +{ + X<&S::f> x; +}; diff --git a/gcc/testsuite/g++.dg/template/non-dependent8.C b/gcc/testsuite/g++.dg/template/non-dependent8.C new file mode 100644 index 00000000000..0adac25f08d --- /dev/null +++ b/gcc/testsuite/g++.dg/template/non-dependent8.C @@ -0,0 +1,22 @@ +// { dg-do compile } + +// Origin: Giovanni Bajo + +// Two-phase name lookup for address of member: +// Detecting overloading function error during parsing + +struct S +{ + int f(char); + int f(int); +}; + +template +struct X +{}; + +template +struct Foo +{ + X<&S::f> x; // { dg-error "convert|no type" } +}; diff --git a/gcc/testsuite/g++.dg/template/non-dependent9.C b/gcc/testsuite/g++.dg/template/non-dependent9.C new file mode 100644 index 00000000000..ee34327ad63 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/non-dependent9.C @@ -0,0 +1,22 @@ +// { dg-do compile } + +// Origin: Giovanni Bajo + +// PR c++/13092: ICE taking address of member which is non-dependent + +struct S +{ + int i; +}; + +template +struct X +{}; + +template +struct Foo +{ + X<&S::i> x; +}; + +template struct Foo;