public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13452] No error on invalid (I think) C++ code
       [not found] <bug-13452-4@http.gcc.gnu.org/bugzilla/>
@ 2013-04-09 17:16 ` paolo.carlini at oracle dot com
  2013-06-16 16:14 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-04-09 17:16 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13452

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |witmer at averagesoftware
                   |                            |dot org

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-04-09 17:15:57 UTC ---
*** Bug 37885 has been marked as a duplicate of this bug. ***


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

* [Bug c++/13452] No error on invalid (I think) C++ code
       [not found] <bug-13452-4@http.gcc.gnu.org/bugzilla/>
  2013-04-09 17:16 ` [Bug c++/13452] No error on invalid (I think) C++ code paolo.carlini at oracle dot com
@ 2013-06-16 16:14 ` paolo.carlini at oracle dot com
  2021-12-06  5:57 ` [Bug c++/13452] No error on invalid CV qualifier on member function returning function pointer pinskia at gcc dot gnu.org
  2021-12-06  5:58 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-16 16:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13452

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at halcy0n dot com

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
*** Bug 26143 has been marked as a duplicate of this bug. ***


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

* [Bug c++/13452] No error on invalid CV qualifier on member function returning function pointer
       [not found] <bug-13452-4@http.gcc.gnu.org/bugzilla/>
  2013-04-09 17:16 ` [Bug c++/13452] No error on invalid (I think) C++ code paolo.carlini at oracle dot com
  2013-06-16 16:14 ` paolo.carlini at oracle dot com
@ 2021-12-06  5:57 ` pinskia at gcc dot gnu.org
  2021-12-06  5:58 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-06  5:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1417

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

* [Bug c++/13452] No error on invalid CV qualifier on member function returning function pointer
       [not found] <bug-13452-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-12-06  5:57 ` [Bug c++/13452] No error on invalid CV qualifier on member function returning function pointer pinskia at gcc dot gnu.org
@ 2021-12-06  5:58 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-06  5:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zhonghao at pku dot org.cn

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 86652 has been marked as a duplicate of this bug. ***

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

* [Bug c++/13452] No error on invalid (I think) C++ code
  2003-12-19 19:28 [Bug c++/13452] New: No error on invalid (I think) C++ code ian at airs dot com
                   ` (2 preceding siblings ...)
  2004-01-12 16:27 ` ian at airs dot com
@ 2005-05-25  1:11 ` ian at airs dot com
  3 siblings, 0 replies; 8+ messages in thread
From: ian at airs dot com @ 2005-05-25  1:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ian at airs dot com  2005-05-25 00:33 -------
Just a note that this still fails to issue an error on mainline.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2003-12-23 18:22:24         |2005-05-25 00:33:19
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13452


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

* [Bug c++/13452] No error on invalid (I think) C++ code
  2003-12-19 19:28 [Bug c++/13452] New: No error on invalid (I think) C++ code ian at airs dot com
  2003-12-23 18:33 ` [Bug c++/13452] " pinskia at gcc dot gnu dot org
  2004-01-12 16:11 ` Rainer dot Bensch at rsd dot rohde-schwarz dot com
@ 2004-01-12 16:27 ` ian at airs dot com
  2005-05-25  1:11 ` ian at airs dot com
  3 siblings, 0 replies; 8+ messages in thread
From: ian at airs dot com @ 2004-01-12 16:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ian at airs dot com  2004-01-12 16:27 -------
Subject: Re:  No error on invalid (I think) C++ code

"Rainer dot Bensch at rsd dot rohde-schwarz dot com" <gcc-bugzilla@gcc.gnu.org> writes:

> You declared a non const member function f() which returns a pointer to a const
> member function. If the const is inside the parenteses, you declare a const 
> member function f() which returns a pointer to a non const member function. 
> Now, consider to place const at both...

I don't agree.  The function f() does not return a pointer to any sort
of member function.  It returns a simple pointer to function.

Consider this test case:

extern int bar();
class C { public: int (*f())() const; };
int (*C::f())() const { return bar; }

Right now this compiles without error.  But the `const' in the
declaration of C::f() is meaningless.  C::f() returns an ordinary
function.  I certainly can't declare `extern int bar() const'.

Conversely, this test case:

class C { public: int (*f())() const; int bar(); };
int (*C::f())() const { return C::bar; }

fails, with:

foo3.cc:2: error: argument of type `int (C::)()' does not match `int (*)()

Similarly, this one:

class C { public: int (*f())() const; int bar() const; };
int (*C::f())() const { return C::bar; }

fails with:

foo3.cc:2: error: argument of type `int (C::)() const' does not match `int (*)()'

(both these error messages are mildly bogus, since the case here is
not an argument mismatch, but a return mismatch, but that is a
separate issue).

So I still think that the trailing const is meaningless, and should
cause an error.

Ian


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13452


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

* [Bug c++/13452] No error on invalid (I think) C++ code
  2003-12-19 19:28 [Bug c++/13452] New: No error on invalid (I think) C++ code ian at airs dot com
  2003-12-23 18:33 ` [Bug c++/13452] " pinskia at gcc dot gnu dot org
@ 2004-01-12 16:11 ` Rainer dot Bensch at rsd dot rohde-schwarz dot com
  2004-01-12 16:27 ` ian at airs dot com
  2005-05-25  1:11 ` ian at airs dot com
  3 siblings, 0 replies; 8+ messages in thread
From: Rainer dot Bensch at rsd dot rohde-schwarz dot com @ 2004-01-12 16:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From Rainer dot Bensch at rsd dot rohde-schwarz dot com  2004-01-12 16:10 -------
(In reply to comment #0)
> However, it now seems to me that there should be an error on the trailing 
const.

No.

>  Otherwise, I have no idea what the trailing const means.  It appears that
> generating a const method (i.e., a method for which `this' is a pointer to
> const) requires
> class C { public: template<typename i> int (*f() const)(); };
> This may be a misunderstanding on my part, but at least some people share my
> misunderstanding; see PR c++/13447.

You declared a non const member function f() which returns a pointer to a const
member function. If the const is inside the parenteses, you declare a const 
member function f() which returns a pointer to a non const member function. 
Now, consider to place const at both...

Cheers, Rainer


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13452


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

* [Bug c++/13452] No error on invalid (I think) C++ code
  2003-12-19 19:28 [Bug c++/13452] New: No error on invalid (I think) C++ code ian at airs dot com
@ 2003-12-23 18:33 ` pinskia at gcc dot gnu dot org
  2004-01-12 16:11 ` Rainer dot Bensch at rsd dot rohde-schwarz dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-23 18:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-23 18:22 -------
Confirmed but not a regression.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-12-23 18:22:24
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13452


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

end of thread, other threads:[~2021-12-06  5:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-13452-4@http.gcc.gnu.org/bugzilla/>
2013-04-09 17:16 ` [Bug c++/13452] No error on invalid (I think) C++ code paolo.carlini at oracle dot com
2013-06-16 16:14 ` paolo.carlini at oracle dot com
2021-12-06  5:57 ` [Bug c++/13452] No error on invalid CV qualifier on member function returning function pointer pinskia at gcc dot gnu.org
2021-12-06  5:58 ` pinskia at gcc dot gnu.org
2003-12-19 19:28 [Bug c++/13452] New: No error on invalid (I think) C++ code ian at airs dot com
2003-12-23 18:33 ` [Bug c++/13452] " pinskia at gcc dot gnu dot org
2004-01-12 16:11 ` Rainer dot Bensch at rsd dot rohde-schwarz dot com
2004-01-12 16:27 ` ian at airs dot com
2005-05-25  1:11 ` ian at airs dot com

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