From: Marek Polacek Date: Wed, 17 Apr 2019 18:26:42 +0000 (+0000) Subject: PR c++/90124 - bogus error with incomplete type in decltype. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f64e89775fc23fc57b1631f0c0e80a96150e3cd8;p=gcc.git PR c++/90124 - bogus error with incomplete type in decltype. * typeck.c (build_class_member_access_expr): Check cp_unevaluated_operand. * g++.dg/cpp0x/decltype70.C: New test. From-SVN: r270418 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 67baed6672f..a37a6c22549 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2019-04-17 Marek Polacek + + PR c++/90124 - bogus error with incomplete type in decltype. + * typeck.c (build_class_member_access_expr): Check + cp_unevaluated_operand. + 2019-04-12 Jakub Jelinek PR c/89933 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 03b14024738..7224d9bf9ed 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2477,7 +2477,8 @@ build_class_member_access_expr (cp_expr object, tree member, /* We didn't complain above about a currently open class, but now we must: we don't know how to refer to a base member before layout is complete. But still don't complain in a template. */ - if (!dependent_type_p (object_type) + if (!cp_unevaluated_operand + && !dependent_type_p (object_type) && !complete_type_or_maybe_complain (object_type, object, complain)) return error_mark_node; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3fb6092b3bf..e9e007769cf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-04-17 Marek Polacek + + PR c++/90124 - bogus error with incomplete type in decltype. + * g++.dg/cpp0x/decltype70.C: New test. + 2019-04-17 Jakub Jelinek PR middle-end/90095 diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype70.C b/gcc/testsuite/g++.dg/cpp0x/decltype70.C new file mode 100644 index 00000000000..b26aca90651 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype70.C @@ -0,0 +1,10 @@ +// PR c++/90124 +// { dg-do compile { target c++11 } } + +class a { +public: + int b; +}; +class c : a { + auto m_fn1() -> decltype(b); +};