public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ PATCH for c++/58022 (bogus abstract class error)
@ 2013-07-30 13:27 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2013-07-30 13:27 UTC (permalink / raw)
  To: gcc-patches List

[-- 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; };

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

only message in thread, other threads:[~2013-07-30 13:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-30 13:27 C++ PATCH for c++/58022 (bogus abstract class error) 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).