public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "d.frey at gmx dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57543] decltype needs explicit 'this' pointer in member function declaration of template class with trailing return type
Date: Sun, 01 Dec 2013 13:40:00 -0000	[thread overview]
Message-ID: <bug-57543-4-KySrHpkrHK@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-57543-4@http.gcc.gnu.org/bugzilla/>

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

Daniel Frey <d.frey at gmx dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |d.frey at gmx dot de

--- Comment #2 from Daniel Frey <d.frey at gmx dot de> ---
Here's another short example which seems to expose the same bug:

template< typename > struct X
{
  void foo() {}

  auto bar() -> decltype( X::foo() ) //1
  {
    return foo();
  }
};

int main()
{
  X<int>().bar();
}

Note that the decltype in //1 causes the problem, not the body of the function.
Changing //1 to decltype(foo()) fails with the same error message, changing it
to either decltype(this->foo()) or decltype(std::declval<X>().foo()) solves the
problem and GCC accepts the code. Also note that Clang compiles all versions
just fine.

The bug seems to occur in unevaluated contexts and only for templates. If you
change the above class X to be a non-template GCC accepts the code as well.


  parent reply	other threads:[~2013-12-01 13:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-06 11:53 [Bug c++/57543] New: decltype needs eplicity " mitchnull+gcc at gmail dot com
2013-06-06 20:46 ` [Bug c++/57543] decltype needs explicit " paolo.carlini at oracle dot com
2013-06-08 14:51 ` daniel.kruegler at googlemail dot com
2013-12-01 13:40 ` d.frey at gmx dot de [this message]
2014-05-27 10:44 ` paolo.carlini at oracle dot com
2014-05-28 16:04 ` paolo.carlini at oracle dot com
2014-05-29 13:53 ` paolo.carlini at oracle dot com
2014-05-29 17:12 ` paolo.carlini at oracle dot com
2014-05-31  8:52 ` paolo.carlini at oracle dot com
2014-05-31  8:52 ` paolo at gcc dot gnu.org
2014-06-03  9:55 ` redi at gcc dot gnu.org

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=bug-57543-4-KySrHpkrHK@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).