@@ -2493,7 +2493,11 @@ location_of (tree t)
if (TREE_CODE (t) == PARM_DECL && DECL_CONTEXT (t))
t = DECL_CONTEXT (t);
else if (TYPE_P (t))
- t = TYPE_MAIN_DECL (t);
+ {
+ t = TYPE_MAIN_DECL (t);
+ if (t == NULL_TREE)
+ return input_location;
+ }
else if (TREE_CODE (t) == OVERLOAD)
t = OVL_FUNCTION (t);
new file mode 100644
@@ -0,0 +1,17 @@
+// PR c++/47703
+
+typedef void (*pfn)(int &);
+
+struct A
+{
+ operator pfn() { return 0; }
+};
+
+void f()
+{
+ const int i = 42;
+ A()(i); // { dg-message "<conversion>" }
+}
+
+// { dg-prune-output "no match" }
+// { dg-prune-output "candidate" }