]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/92859 - ADL and bit-field.
authorJason Merrill <jason@redhat.com>
Fri, 13 Dec 2019 05:10:06 +0000 (00:10 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 13 Dec 2019 05:10:06 +0000 (00:10 -0500)
We also need unlowered_expr_type when considering associated types for ADL.

* name-lookup.c: Use unlowered_expr_type.

From-SVN: r279334

gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/g++.dg/overload/bit-field1.C [new file with mode: 0644]

index bda8304df575a2ae6e278d43ee45b7b6dfae1edd..5b05e84b4c3aa41e256fd98283084ac2dd5b5ccb 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-11  Jason Merrill  <jason@redhat.com>
+
+       PR c++/92859 - ADL and bit-field.
+       * name-lookup.c: Use unlowered_expr_type.
+
 2019-12-11  Jason Merrill  <jason@redhat.com>
 
        PR c++/92446 - deduction of class NTTP.
index 29004d920b10f3d1cbf6efb2747bc460df15c590..4fea4c04c66d23c7d672092d67f988e36a19d365 100644 (file)
@@ -909,7 +909,7 @@ name_lookup::adl_expr (tree expr)
 
   if (TREE_TYPE (expr) != unknown_type_node)
     {
-      adl_type (TREE_TYPE (expr));
+      adl_type (unlowered_expr_type (expr));
       return;
     }
 
diff --git a/gcc/testsuite/g++.dg/overload/bit-field1.C b/gcc/testsuite/g++.dg/overload/bit-field1.C
new file mode 100644 (file)
index 0000000..318caaa
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/92859
+// { dg-do compile { target c++11 } }
+
+void f(int) = delete;
+
+struct ES { 
+  enum E { v }; 
+  friend void f(E) { }
+};
+
+struct S {
+  ES::E e : 1; 
+};
+
+int main() {
+  S s{}; 
+  f (s.e);
+}