public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mitchnull+gcc at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57543] New: decltype needs eplicity 'this' pointer in member function declaration of template class with trailing return type
Date: Thu, 06 Jun 2013 11:53:00 -0000 [thread overview]
Message-ID: <bug-57543-4@http.gcc.gnu.org/bugzilla/> (raw)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57543
Bug ID: 57543
Summary: decltype needs eplicity 'this' pointer in member
function declaration of template class with trailing
return type
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mitchnull+gcc at gmail dot com
Created attachment 30268
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30268&action=edit
decltype-implicit-this.cpp
When using trailing return-type for member functions of a template class, the
'this' pointer must be explicitly mentioned. This should not be necessary (The
implicit 'this' works with a non-template class).
Example:
emplate <typename T>
struct DecltypeConstThis {
T f() const { return T{}; }
auto g() -> decltype(this->f()) { return this->f(); }
auto h() const -> decltype(f()) { return f(); } // this should work the
same as g() above (with implicit 'this')
};
struct Working {
int f() const { return 0; }
auto h() const -> decltype(f()) { return 0; }
};
int main() {
Working w;
w.h();
DecltypeConstThis<int> d;
d.g();
d.h();
return 0;
}
compiler output:
[mitch@deneb src]$ g++ -std=c++11 -o decltype-implicit-this
decltype-implicit-this.cpp
decltype-implicit-this.cpp: In instantiation of ‘struct
DecltypeConstThis<int>’:
decltype-implicit-this.cpp:22:28: required from here
decltype-implicit-this.cpp:7:36: error: cannot call member function ‘T
DecltypeConstThis<T>::f() const [with T = int]’ without object
auto h() const -> decltype(f()) { return f(); } // this should work the
same as g() above (with implicit 'this')
^
decltype-implicit-this.cpp: In function ‘int main()’:
decltype-implicit-this.cpp:24:7: error: ‘struct DecltypeConstThis<int>’ has no
member named ‘h’
d.h();
^
ps: possibly related to bug #54359
>From gcc-bugs-return-423907-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jun 06 12:43:36 2013
Return-Path: <gcc-bugs-return-423907-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 15543 invoked by alias); 6 Jun 2013 12:43:36 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 15502 invoked by uid 48); 6 Jun 2013 12:43:29 -0000
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/54370] [4.7 Regression] error: non-trivial conversion in unary operation
Date: Thu, 06 Jun 2013 12:43:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.7.0
X-Bugzilla-Keywords: ice-on-valid-code, patch
X-Bugzilla-Severity: normal
X-Bugzilla-Who: burnus at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.7.4
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: keywords cc target_milestone short_desc
Message-ID: <bug-54370-4-rQDyUZ5LjN@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-54370-4@http.gcc.gnu.org/bugzilla/>
References: <bug-54370-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-06/txt/msg00286.txt.bz2
Content-length: 862
http://gcc.gnu.org/bugzilla/show_bug.cgi?idT370
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code, patch
CC| |burnus at gcc dot gnu.org
Target Milestone|--- |4.7.4
Summary|error: non-trivial |[4.7 Regression] error:
|conversion in unary |non-trivial conversion in
|operation |unary operation
--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The bug was solved in August 2012 on the GCC 4.8 trunk; however, as it is a
regression, it should have been backported to the GCC 4.7 branch.
next reply other threads:[~2013-06-06 11:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-06 11:53 mitchnull+gcc at gmail dot com [this message]
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
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@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).