[Bug c++/52949] New: decltype too sensitive to order of declarations?
akim.demaille at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Apr 12 15:20:00 GMT 2012
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'
More information about the Gcc-bugs
mailing list