public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: C++ PATCH for c++/58022 (bogus abstract class error)
Date: Tue, 30 Jul 2013 13:27:00 -0000	[thread overview]
Message-ID: <51F7BEA9.6030708@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 374 bytes --]

Fallout from when I started checking for abstract classes as function 
parameter types; if we see an incomplete type when we check for 
abstractness, we save it to a list and check it again later when it's 
complete.  But we shouldn't do that in SFINAE context.  This change is 
already on the trunk, as part of a larger patch.

Tested x86_64-pc-linux-gnu, applying to 4.8.

[-- Attachment #2: 58022.patch --]
[-- Type: text/x-patch, Size: 1379 bytes --]

commit 911dd30618250216d5eadca07b98a264d14f422f
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Jul 29 16:52:53 2013 -0400

    	PR c++/58022
    	* typeck2.c (abstract_virtuals_error_sfinae): Don't remember
    	lookup in SFINAE context.

diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 9b7db62..9c9f075 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -262,7 +262,7 @@ abstract_virtuals_error_sfinae (tree decl, tree type, tsubst_flags_t complain)
      so that we can check again once it is completed. This makes sense
      only for objects for which we have a declaration or at least a
      name.  */
-  if (!COMPLETE_TYPE_P (type))
+  if (!COMPLETE_TYPE_P (type) && (complain & tf_error))
     {
       void **slot;
       struct pending_abstract_type *pat;
diff --git a/gcc/testsuite/g++.dg/template/abstract1.C b/gcc/testsuite/g++.dg/template/abstract1.C
new file mode 100644
index 0000000..20bbf5a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/abstract1.C
@@ -0,0 +1,12 @@
+// PR c++/58022
+
+template <class T> struct A { };
+template <class T> A<T> & operator<< (A<T>&, T);
+template <class T> class foo;
+template <class T> A<char> & operator<<(A<char>& o, const foo<T>& l);
+template <class T> class foo  {
+    friend A<char>& operator<< <T> (A<char>& o, const foo<T>& l);
+};
+class bar;
+foo<bar> fb;
+class bar { virtual void baz()=0; };

                 reply	other threads:[~2013-07-30 13:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51F7BEA9.6030708@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).