From: Jason Merrill Date: Wed, 11 Dec 2019 16:48:44 +0000 (-0500) Subject: PR c++/92859 - ADL and bit-field. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7c0a61870e0f8fe8ad1e21594f92ab454ca60c0d;p=gcc.git PR c++/92859 - ADL and bit-field. We also need unlowered_expr_type when considering associated types for ADL. * name-lookup.c: Use unlowered_expr_type. From-SVN: r279229 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ad08ff00e38..4cb79b2c24e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2019-12-11 Jason Merrill + PR c++/92859 - ADL and bit-field. + * name-lookup.c: Use unlowered_expr_type. + PR c++/92446 - deduction of class NTTP. * pt.c (deducible_expression): Look through VIEW_CONVERT_EXPR. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index e82eaf222c0..e64cd9a9d66 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -908,7 +908,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 index 00000000000..318caaaeb65 --- /dev/null +++ b/gcc/testsuite/g++.dg/overload/bit-field1.C @@ -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); +}