public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54336] New: [c++0x] diagnostics for functions with arg-dependent return types have bad signatures
@ 2012-08-20 22:37 luto at mit dot edu
2012-08-20 22:40 ` [Bug c++/54336] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: luto at mit dot edu @ 2012-08-20 22:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54336
Bug #: 54336
Summary: [c++0x] diagnostics for functions with arg-dependent
return types have bad signatures
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: luto@mit.edu
This code:
template<typename T> auto func(T x) -> decltype(x.method())
{
static_assert(false, "test");
}
fails to compile with:
decltype_return.cc: In function 'decltype (x.method()) func(T)':
decltype_return.cc:3:3: error: static assertion failed: test
static_assert(false, "test");
^
What's 'decltype (x.method()) func(T)'? x isn't defined. 'auto func(T x) ->
decltype(x.method())' or even 'decltype (x.method()) func (T x)' would be
better.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/54336] [c++0x] diagnostics for functions with arg-dependent return types have bad signatures
2012-08-20 22:37 [Bug c++/54336] New: [c++0x] diagnostics for functions with arg-dependent return types have bad signatures luto at mit dot edu
@ 2012-08-20 22:40 ` pinskia at gcc dot gnu.org
2012-08-20 23:21 ` luto at mit dot edu
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-08-20 22:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54336
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-08-20 22:39:47 UTC ---
The issue is we decided that static_asserts which are dependent should be
resolved at definition time rather than instantiation time.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/54336] [c++0x] diagnostics for functions with arg-dependent return types have bad signatures
2012-08-20 22:37 [Bug c++/54336] New: [c++0x] diagnostics for functions with arg-dependent return types have bad signatures luto at mit dot edu
2012-08-20 22:40 ` [Bug c++/54336] " pinskia at gcc dot gnu.org
@ 2012-08-20 23:21 ` luto at mit dot edu
2014-06-01 19:59 ` paolo.carlini at oracle dot com
2021-08-11 23:41 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: luto at mit dot edu @ 2012-08-20 23:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54336
--- Comment #2 from Andy Lutomirski <luto at mit dot edu> 2012-08-20 23:21:32 UTC ---
Fair enough. Here's a better example:
struct A { int method(); };
template<typename T> auto func(T x) -> decltype(x.method())
{
bogus(x);
}
int main() { func(A()); }
The error is:
decltype_return.cc: In instantiation of 'decltype (x.method()) func(T) [with T
= A; decltype (x.method()) = int]':
decltype_return.cc:8:22: required from here
decltype_return.cc:5:3: error: 'bogus' was not declared in this scope
bogus(x);
^
'decltype (x.method())' is still meaningless in that context. Even just 'auto
func(T) [with ...; auto = int]' might be less puzzling.
(This is a very minor issue -- I just found it puzzling when I hit it earlier
today in an STL error message.)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/54336] [c++0x] diagnostics for functions with arg-dependent return types have bad signatures
2012-08-20 22:37 [Bug c++/54336] New: [c++0x] diagnostics for functions with arg-dependent return types have bad signatures luto at mit dot edu
2012-08-20 22:40 ` [Bug c++/54336] " pinskia at gcc dot gnu.org
2012-08-20 23:21 ` luto at mit dot edu
@ 2014-06-01 19:59 ` paolo.carlini at oracle dot com
2021-08-11 23:41 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-06-01 19:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54336
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2014-06-01
Assignee|unassigned at gcc dot gnu.org |paolo.carlini at oracle dot com
Ever confirmed|0 |1
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Mine.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/54336] [c++0x] diagnostics for functions with arg-dependent return types have bad signatures
2012-08-20 22:37 [Bug c++/54336] New: [c++0x] diagnostics for functions with arg-dependent return types have bad signatures luto at mit dot edu
` (2 preceding siblings ...)
2014-06-01 19:59 ` paolo.carlini at oracle dot com
@ 2021-08-11 23:41 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-11 23:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54336
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC and clang agree here and rejects the code.
ICC and MSVC accept the code.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-08-11 23:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-20 22:37 [Bug c++/54336] New: [c++0x] diagnostics for functions with arg-dependent return types have bad signatures luto at mit dot edu
2012-08-20 22:40 ` [Bug c++/54336] " pinskia at gcc dot gnu.org
2012-08-20 23:21 ` luto at mit dot edu
2014-06-01 19:59 ` paolo.carlini at oracle dot com
2021-08-11 23:41 ` 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).