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
--- /dev/null
+// { 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" }
+};
--- /dev/null
+// { 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;
+};
--- /dev/null
+// { 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" }
+};
--- /dev/null
+// { 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>;