public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97890] New: Abstract virtual classes suddenly allowed as parameter types ?
@ 2020-11-18 10:10 dcb314 at hotmail dot com
  2020-11-18 10:41 ` [Bug c++/97890] " dcb314 at hotmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dcb314 at hotmail dot com @ 2020-11-18 10:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97890

            Bug ID: 97890
           Summary: Abstract virtual classes suddenly allowed as parameter
                    types ?
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

For this wrong C++ code:

struct S        // abstract
{
        int b;

        virtual void f() = 0;
};

extern void g( struct S);

Suddenly seems to have started working sometime between 20201114
and 20201116.

/home/dcb/gcc/results.20201114/bin/gcc
nov18b.cc:9:24: error: cannot declare parameter to be of abstract type ‘S’
    9 | extern void g( struct S);
      |                        ^
nov18b.cc:2:8: note:   because the following virtual functions are pure within
‘S’:
    2 | struct S        // abstract
      |        ^
nov18b.cc:6:22: note:     ‘virtual void S::f()’
    6 |         virtual void f() = 0;
      |                      ^
/home/dcb/gcc/results.20201116.valgrind/bin/gcc

Compiler dated 20201104 has git hash 8270a7238ba1b535
and compiler dated 20201116 has git hash 2f473f4b065d3cc0.

Accident or design ?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/97890] Abstract virtual classes suddenly allowed as parameter types ?
  2020-11-18 10:10 [Bug c++/97890] New: Abstract virtual classes suddenly allowed as parameter types ? dcb314 at hotmail dot com
@ 2020-11-18 10:41 ` dcb314 at hotmail dot com
  2020-11-18 11:29 ` dcb314 at hotmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dcb314 at hotmail dot com @ 2020-11-18 10:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97890

--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
For C++ testsuite file g++.dg/other/abstract8.C, the number
of errors seems to have gone down from 21 to 16.

Here is a diff of the errors:

$ diff /tmp/00 /tmp/11
1d0
< ./g++.dg/other/abstract8.C:13:9: error: invalid abstract type ‘A’ for ‘ar’
4,7d2
< ./g++.dg/other/abstract8.C:16:15: error: cannot allocate an object of
abstract type ‘A’
< ./g++.dg/other/abstract8.C:19:10: error: cannot declare variable ‘a’ to be of
abstract type ‘A’
< ./g++.dg/other/abstract8.C:21:1: error: invalid abstract return type ‘A’
< ./g++.dg/other/abstract8.C:22:9: error: cannot declare parameter to be of
abstract type ‘A’
9c4
< ./g++.dg/other/abstract8.C:26:1: error: invalid abstract return type ‘A’
---
> ./g++.dg/other/abstract8.C:25:4: error: creating array of ‘A’, which is an abstract class type
$

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/97890] Abstract virtual classes suddenly allowed as parameter types ?
  2020-11-18 10:10 [Bug c++/97890] New: Abstract virtual classes suddenly allowed as parameter types ? dcb314 at hotmail dot com
  2020-11-18 10:41 ` [Bug c++/97890] " dcb314 at hotmail dot com
@ 2020-11-18 11:29 ` dcb314 at hotmail dot com
  2020-11-18 11:57 ` dcb314 at hotmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dcb314 at hotmail dot com @ 2020-11-18 11:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97890

--- Comment #2 from David Binderman <dcb314 at hotmail dot com> ---
I am having my first go at a git bisect. I am trying git hash 9243f0fba68339fa.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/97890] Abstract virtual classes suddenly allowed as parameter types ?
  2020-11-18 10:10 [Bug c++/97890] New: Abstract virtual classes suddenly allowed as parameter types ? dcb314 at hotmail dot com
  2020-11-18 10:41 ` [Bug c++/97890] " dcb314 at hotmail dot com
  2020-11-18 11:29 ` dcb314 at hotmail dot com
@ 2020-11-18 11:57 ` dcb314 at hotmail dot com
  2020-11-18 12:19 ` dcb314 at hotmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dcb314 at hotmail dot com @ 2020-11-18 11:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97890

--- Comment #3 from David Binderman <dcb314 at hotmail dot com> ---

Git hash 9243f0fba68339fa is silent on the code. Trying git hash
253c415a1acba507

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/97890] Abstract virtual classes suddenly allowed as parameter types ?
  2020-11-18 10:10 [Bug c++/97890] New: Abstract virtual classes suddenly allowed as parameter types ? dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2020-11-18 11:57 ` dcb314 at hotmail dot com
@ 2020-11-18 12:19 ` dcb314 at hotmail dot com
  2020-11-18 12:44 ` redi at gcc dot gnu.org
  2021-08-17  5:30 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: dcb314 at hotmail dot com @ 2020-11-18 12:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97890

David Binderman <dcb314 at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #4 from David Binderman <dcb314 at hotmail dot com> ---
A quick review of the git log suggests Jason Merrill 's commit hashed as
baf38d2e363971ed8baa5f82b2eaf21cd8e74aae is a hot candidate.

Given that clang-11 won't compile the code (even with -std=c++20) 
and gcc didn't used to, is it perhaps a good idea to 

a) go back to old behaviour by default for gcc.
b) put gcc's new behaviour into -std=c++20 only.

Perhaps Jason is well placed to advise further.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/97890] Abstract virtual classes suddenly allowed as parameter types ?
  2020-11-18 10:10 [Bug c++/97890] New: Abstract virtual classes suddenly allowed as parameter types ? dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2020-11-18 12:19 ` dcb314 at hotmail dot com
@ 2020-11-18 12:44 ` redi at gcc dot gnu.org
  2021-08-17  5:30 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-11-18 12:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97890

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The commit log refers to
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0929r2.html which was
accepted as a defect report (i.e. a fix for previous standards) in Rapperswil
2018.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/97890] Abstract virtual classes suddenly allowed as parameter types ?
  2020-11-18 10:10 [Bug c++/97890] New: Abstract virtual classes suddenly allowed as parameter types ? dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2020-11-18 12:44 ` redi at gcc dot gnu.org
@ 2021-08-17  5:30 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-17  5:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97890

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So the reasoning is take:
struct S;
extern void g( struct S);
struct S        // abstract
{
        int b;

        virtual void f() = 0;
};

With the previous wording, that would also be invalid but was it? ICC and clang
accept it too.
So the idea is to make the above still valid but also allow where g is after
the definition of the struct.
it would be invalid to use g with that argument anwayws in the definition
rather than declaration.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-17  5:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18 10:10 [Bug c++/97890] New: Abstract virtual classes suddenly allowed as parameter types ? dcb314 at hotmail dot com
2020-11-18 10:41 ` [Bug c++/97890] " dcb314 at hotmail dot com
2020-11-18 11:29 ` dcb314 at hotmail dot com
2020-11-18 11:57 ` dcb314 at hotmail dot com
2020-11-18 12:19 ` dcb314 at hotmail dot com
2020-11-18 12:44 ` redi at gcc dot gnu.org
2021-08-17  5:30 ` pinskia at gcc dot gnu.org

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).