public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52949] New: decltype too sensitive to order of declarations?
@ 2012-04-12 15:20 akim.demaille at gmail dot com
2012-04-12 16:00 ` [Bug c++/52949] " redi at gcc dot gnu.org
2012-04-12 16:12 ` redi at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: akim.demaille at gmail dot com @ 2012-04-12 15:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52949
Bug #: 52949
Summary: decltype too sensitive to order of declarations?
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: akim.demaille@gmail.com
Created attachment 27141
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27141
Test case
I am not sure of myself on this one. I have read a preversion of the standard
(and I checked n2343 too), and I did not find anything very clear about this.
I do understand that the "rich" version might require some dependency
resolution in full generality, but then again, I have not found the restriction
spelled out in the standard. The only restriction I spotted is the case of
overloaded functions. I apologize if this is the expected behavior.
In the following example, the first use of decltype fails because it does not
see the member_ definition, which is right after it. The second decltype
passes.
$ g++-mp-4.7 --version
g++-mp-4.7 (GCC) 4.7.0
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++-mp-4.7 -std=c++11 foo.cc
foo.cc:3:27: error: 'member_' was not declared in this scope
foo.cc:3:27: error: 'member_' was not declared in this scope
foo.cc: In function 'int main()':
foo.cc:12:5: error: 'struct Vector' has no member named 'val1'
$ g++-mp-4.8 --version
g++-mp-4.8 (GCC) 4.8.0 20120408 (experimental)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++-mp-4.8 -std=c++11 foo.cc
foo.cc:3:27: error: 'member_' was not declared in this scope
foo.cc:3:27: error: 'member_' was not declared in this scope
foo.cc: In function 'int main()':
foo.cc:12:5: error: 'struct Vector' has no member named 'val1'
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/52949] decltype too sensitive to order of declarations?
2012-04-12 15:20 [Bug c++/52949] New: decltype too sensitive to order of declarations? akim.demaille at gmail dot com
@ 2012-04-12 16:00 ` redi at gcc dot gnu.org
2012-04-12 16:12 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-12 16:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52949
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-12 15:59:51 UTC ---
The name member_ isn't in scope until it's declared, this is nothing to do with
decltype.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/52949] decltype too sensitive to order of declarations?
2012-04-12 15:20 [Bug c++/52949] New: decltype too sensitive to order of declarations? akim.demaille at gmail dot com
2012-04-12 16:00 ` [Bug c++/52949] " redi at gcc dot gnu.org
@ 2012-04-12 16:12 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-12 16:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52949
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-12 16:12:15 UTC ---
this is no different to;
struct Vector
{
static const int i = sizeof(member_); // error
int member_;
static const int j = sizeof(member_); // ok
};
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-12 16:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-12 15:20 [Bug c++/52949] New: decltype too sensitive to order of declarations? akim.demaille at gmail dot com
2012-04-12 16:00 ` [Bug c++/52949] " redi at gcc dot gnu.org
2012-04-12 16:12 ` redi 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).