re PR c++/13092 (Accepts invalid pointer-to-member conversion)
authorJason Merrill <jason@gcc.gnu.org>
Tue, 1 Jun 2004 15:54:33 +0000 (11:54 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 1 Jun 2004 15:54:33 +0000 (11:54 -0400)
        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

gcc/testsuite/g++.dg/template/non-dependent10.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/non-dependent7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/non-dependent8.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/non-dependent9.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/template/non-dependent10.C b/gcc/testsuite/g++.dg/template/non-dependent10.C
new file mode 100644 (file)
index 0000000..369e137
--- /dev/null
@@ -0,0 +1,21 @@
+// { 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" }
+};
diff --git a/gcc/testsuite/g++.dg/template/non-dependent7.C b/gcc/testsuite/g++.dg/template/non-dependent7.C
new file mode 100644 (file)
index 0000000..c046312
--- /dev/null
@@ -0,0 +1,22 @@
+// { 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;
+};
diff --git a/gcc/testsuite/g++.dg/template/non-dependent8.C b/gcc/testsuite/g++.dg/template/non-dependent8.C
new file mode 100644 (file)
index 0000000..0adac25
--- /dev/null
@@ -0,0 +1,22 @@
+// { 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" }
+};
diff --git a/gcc/testsuite/g++.dg/template/non-dependent9.C b/gcc/testsuite/g++.dg/template/non-dependent9.C
new file mode 100644 (file)
index 0000000..ee34327
--- /dev/null
@@ -0,0 +1,22 @@
+// { 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>;