PR c++/90124 - bogus error with incomplete type in decltype.
authorMarek Polacek <polacek@redhat.com>
Wed, 17 Apr 2019 18:26:42 +0000 (18:26 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 17 Apr 2019 18:26:42 +0000 (18:26 +0000)
* typeck.c (build_class_member_access_expr): Check
cp_unevaluated_operand.

* g++.dg/cpp0x/decltype70.C: New test.

From-SVN: r270418

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/decltype70.C [new file with mode: 0644]

index 67baed6672f4f527670cb85749ddbcce17b945e9..a37a6c225494a2e2ea7ee5bb27809e84cb0335be 100644 (file)
@@ -1,3 +1,9 @@
+2019-04-17  Marek Polacek  <polacek@redhat.com>
+
+       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  <jakub@redhat.com>
 
        PR c/89933
index 03b14024738ff4a28d6abcf6fe748aeb04001e22..7224d9bf9ed67e36e265c9de6fa06b5294775cfb 100644 (file)
@@ -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;
index 3fb6092b3bfda79583d6298f5e46f72537fa51bb..e9e007769cf6d4409917aaf7f4bfff79a79f7491 100644 (file)
@@ -1,3 +1,8 @@
+2019-04-17  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/90124 - bogus error with incomplete type in decltype.
+       * g++.dg/cpp0x/decltype70.C: New test.
+
 2019-04-17  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..b26aca9
--- /dev/null
@@ -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);
+};