public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-8447] c++: auto and dependent member name [PR105734]
@ 2022-06-01 19:53 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2022-06-01 19:53 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b090938e61260ce841a0d51de3407881a38e3c52

commit r12-8447-gb090938e61260ce841a0d51de3407881a38e3c52
Author: Jason Merrill <jason@redhat.com>
Date:   Tue May 31 16:31:35 2022 -0400

    c++: auto and dependent member name [PR105734]
    
    In r12-3643 I improved our handling of type names after . or -> when
    unqualified lookup doesn't find anything, but it needs to handle auto
    specially.
    
            PR c++/105734
    
    gcc/cp/ChangeLog:
    
            * parser.cc (cp_parser_postfix_dot_deref_expression): Use typeof
            if the expression has auto type.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/cpp0x/auto57.C: New test.

Diff:
---
 gcc/cp/parser.cc                    |  2 +-
 gcc/testsuite/g++.dg/cpp0x/auto57.C | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 1173056dc0a..a1fe985fb7c 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -8254,7 +8254,7 @@ cp_parser_postfix_dot_deref_expression (cp_parser *parser,
       tree type = TREE_TYPE (postfix_expression);
       /* If we don't have a (type-dependent) object of class type, use
 	 typeof to figure out the type of the object.  */
-      if (type == NULL_TREE)
+      if (type == NULL_TREE || is_auto (type))
 	type = finish_typeof (postfix_expression);
       parser->context->object_type = type;
     }
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto57.C b/gcc/testsuite/g++.dg/cpp0x/auto57.C
new file mode 100644
index 00000000000..fedcfde2f0c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/auto57.C
@@ -0,0 +1,15 @@
+// PR c++/105734
+// { dg-do compile { target c++11 } }
+
+namespace N {
+  struct A { };
+  A f(A);
+}
+
+template <class T>
+void bar() {
+  auto m = f(T());
+  m.~A();
+}
+
+void foo() { bar<N::A>(); }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-01 19:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01 19:53 [gcc r12-8447] c++: auto and dependent member name [PR105734] Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).