public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53721] New: "this" not allowed in trailing return type
@ 2012-06-19  3:45 spe56nw9 at vivid dot ocn.ne.jp
  2012-06-20 12:35 ` [Bug c++/53721] " daniel.kruegler at googlemail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: spe56nw9 at vivid dot ocn.ne.jp @ 2012-06-19  3:45 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53721
           Summary: "this" not allowed in trailing return type
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: spe56nw9@vivid.ocn.ne.jp


gcc 4.7.0 outputs following errors when "this" pointer used in trailing return
type:
error: invalid use of incomplete type 'struct A'
error: forward declaration of 'struct A'
error: invalid use of incomplete type 'struct A'
error: forward declaration of 'struct A'

However, according to [expr.prim.general]§5.1.1 clause 3 it should be valid
because it appears after the "cv-qualifier-seq".

Code Example:

struct A
{
    void f() {};
    auto g() -> decltype(this->f())
    {

    }

};

Possible duplicate of Bug 52869, however that is about noexcept clauses.


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

* [Bug c++/53721] "this" not allowed in trailing return type
  2012-06-19  3:45 [Bug c++/53721] New: "this" not allowed in trailing return type spe56nw9 at vivid dot ocn.ne.jp
@ 2012-06-20 12:35 ` daniel.kruegler at googlemail dot com
  2012-06-20 13:42 ` [Bug c++/53721] [C++11] " redi at gcc dot gnu.org
  2013-04-24 16:48 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-06-20 12:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-06-20 12:34:44 UTC ---
I agree that the example should be accepted. I would like to add one further
related example directly from the standard specification. The example from
[expr.prim.general] p3 is also rejected in C++11 mode:

struct A {
  char g();
  template<class T> auto f(T t) -> decltype(t + g())
  { return t + g(); }
};

template auto A::f(int t) -> decltype(t + g()); // Line 7

reporting on gcc 4.8.0 20120610 (experimental):

"7|error: cannot call member function 'char A::g()' without object"


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

* [Bug c++/53721] [C++11] "this" not allowed in trailing return type
  2012-06-19  3:45 [Bug c++/53721] New: "this" not allowed in trailing return type spe56nw9 at vivid dot ocn.ne.jp
  2012-06-20 12:35 ` [Bug c++/53721] " daniel.kruegler at googlemail dot com
@ 2012-06-20 13:42 ` redi at gcc dot gnu.org
  2013-04-24 16:48 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2012-06-20 13:42 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-06-20
            Summary|"this" not allowed in       |[C++11] "this" not allowed
                   |trailing return type        |in trailing return type
     Ever Confirmed|0                           |1


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

* [Bug c++/53721] [C++11] "this" not allowed in trailing return type
  2012-06-19  3:45 [Bug c++/53721] New: "this" not allowed in trailing return type spe56nw9 at vivid dot ocn.ne.jp
  2012-06-20 12:35 ` [Bug c++/53721] " daniel.kruegler at googlemail dot com
  2012-06-20 13:42 ` [Bug c++/53721] [C++11] " redi at gcc dot gnu.org
@ 2013-04-24 16:48 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2013-04-24 16:48 UTC (permalink / raw)
  To: gcc-bugs


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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|                            |FIXED
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.9.0

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2013-04-24 16:48:00 UTC ---
Fixed for 4.9.


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

end of thread, other threads:[~2013-04-24 16:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-19  3:45 [Bug c++/53721] New: "this" not allowed in trailing return type spe56nw9 at vivid dot ocn.ne.jp
2012-06-20 12:35 ` [Bug c++/53721] " daniel.kruegler at googlemail dot com
2012-06-20 13:42 ` [Bug c++/53721] [C++11] " redi at gcc dot gnu.org
2013-04-24 16:48 ` jason 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).