public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/35949] New: 'const' attribute applied to typedefed type in methods's return is ignored
@ 2008-04-15 19:08 yuri at tsoft dot com
2008-04-15 19:11 ` [Bug c++/35949] " pinskia at gcc dot gnu dot org
2008-04-15 20:11 ` schwab at suse dot de
0 siblings, 2 replies; 3+ messages in thread
From: yuri at tsoft dot com @ 2008-04-15 19:08 UTC (permalink / raw)
To: gcc-bugs
In the following code 'const VR' in declaration of the return value of 'kk'
works as just 'VR', without constness.
In arguments 'const VR' is applied as const.
---- code example ----
typedef int X;
struct S {
typedef X& VR; // <--- VR is declared as X by-reference
X x;
// uncomment one of these two lines:
const VR kk(VR) const { return (x); } // <--- bug: first 'const' is
ignored and function is defined as returning *not* const causing compiler error
message
// const X& kk(VR) const { return (x); } // <--- ok: function is defined as
returning const by-reference
};
void f() {
typedef S::VR VR;
const X& (S::*fn)(VR) const; // <---: ask for the function returning
by-reference
fn = &S::kk; // <--- error message here
}
--
Summary: 'const' attribute applied to typedefed type in methods's
return is ignored
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: yuri at tsoft dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35949
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/35949] 'const' attribute applied to typedefed type in methods's return is ignored
2008-04-15 19:08 [Bug c++/35949] New: 'const' attribute applied to typedefed type in methods's return is ignored yuri at tsoft dot com
@ 2008-04-15 19:11 ` pinskia at gcc dot gnu dot org
2008-04-15 20:11 ` schwab at suse dot de
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-04-15 19:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2008-04-15 19:10 -------
const VR is different from const X&.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35949
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/35949] 'const' attribute applied to typedefed type in methods's return is ignored
2008-04-15 19:08 [Bug c++/35949] New: 'const' attribute applied to typedefed type in methods's return is ignored yuri at tsoft dot com
2008-04-15 19:11 ` [Bug c++/35949] " pinskia at gcc dot gnu dot org
@ 2008-04-15 20:11 ` schwab at suse dot de
1 sibling, 0 replies; 3+ messages in thread
From: schwab at suse dot de @ 2008-04-15 20:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from schwab at suse dot de 2008-04-15 20:10 -------
"const VR" is the same as "X& const", and qualifiers on non-lvalues are
ignored.
--
schwab at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35949
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-04-15 20:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-15 19:08 [Bug c++/35949] New: 'const' attribute applied to typedefed type in methods's return is ignored yuri at tsoft dot com
2008-04-15 19:11 ` [Bug c++/35949] " pinskia at gcc dot gnu dot org
2008-04-15 20:11 ` schwab at suse dot de
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).