public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/38020] Undiagnosed const violation in pointer conversion in CRTP context.
[not found] <bug-38020-4@http.gcc.gnu.org/bugzilla/>
@ 2011-10-01 23:38 ` paolo.carlini at oracle dot com
0 siblings, 0 replies; 2+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-01 23:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38020
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC|gcc-bugs at gcc dot gnu.org |paolo.carlini at oracle dot
| |com
Resolution| |FIXED
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-01 23:37:06 UTC ---
Fixed in 4.6.x.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/38020] Undiagnosed const violation in pointer conversion in CRTP context.
2008-11-05 9:37 [Bug c++/38020] New: " gcc-bugzilla at contacts dot eelis dot net
@ 2008-11-07 11:07 ` gccbugs at marcusbannerman dot co dot uk
0 siblings, 0 replies; 2+ messages in thread
From: gccbugs at marcusbannerman dot co dot uk @ 2008-11-07 11:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from gccbugs at marcusbannerman dot co dot uk 2008-11-07 11:05 -------
I have the same problem, it is a static_cast problem not respecting const
correctness of pointers E.g.
class BaseClass {};
class someClass:public BaseClass
{
public:
void someFunction() {}
};
int main()
{
//g++ (GCC) 4.1.2 (Gentoo 4.1.2 p1.1)
//Run as g++ test.cpp
someClass A;
const BaseClass* ptrA(&A);
//Should fail on compile with not const function, does not
static_cast<const someClass*>(ptrA)->someFunction();
//This DOES fail
static_cast<const someClass&>(*ptrA).someFunction();
/*Output is
test.cpp: In function 'int main()':
test.cpp:16: error: passing 'const someClass' as 'this' argument of
'void someClass::someFunction()' discards qualifiers
*/
}
--
gccbugs at marcusbannerman dot co dot uk changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gccbugs at marcusbannerman
| |dot co dot uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38020
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-10-01 23:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-38020-4@http.gcc.gnu.org/bugzilla/>
2011-10-01 23:38 ` [Bug c++/38020] Undiagnosed const violation in pointer conversion in CRTP context paolo.carlini at oracle dot com
2008-11-05 9:37 [Bug c++/38020] New: " gcc-bugzilla at contacts dot eelis dot net
2008-11-07 11:07 ` [Bug c++/38020] " gccbugs at marcusbannerman dot co dot uk
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).