public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const
@ 2009-02-26 13:55 dodji at gcc dot gnu dot org
2009-02-26 16:56 ` [Bug libstdc++/39310] " jason at gcc dot gnu dot org
` (13 more replies)
0 siblings, 14 replies; 15+ messages in thread
From: dodji at gcc dot gnu dot org @ 2009-02-26 13:55 UTC (permalink / raw)
To: gcc-bugs
In the test file
libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_function_pointer/value.cc,
the test
VERIFY( (test_category<is_member_function_pointer, int (ClassType::*) (int)
const>(true)) );
should not PASS IMO.
It passes today because of a bug in gcc. More on this in some comments to come
below.
Why shouldn't it PASS ?
Consider:
struct remove_const<T> {};
struct remove_const<T const>
{
typedef T type;
};
The is_member_function_pointer template in the value.cc is written based on
the assumption that the T in the template parameter of
struct remove_const<T const>
{
typedef T type;
};
Should deduce to int (A::*) (void), when we try to instantiate
remove_const<int (A::*) (void) const>; Hence, the current implementation of
is_member_function_pointer assumes that
struct remove_const<T const>
{
typedef T type;
};
should be intantiated.
Actually T const is not compatible with int (A::*) (void) vonst; So it's the
template struct remove_const<T> {}; that should be instantiated. Not its
specialization.
So the test VERIFY( (test_category<is_member_function_pointer,
int (ClassType::*) (int) const>(true)) ); should not PASS.
I will paste in the comments a patch to apply to GCC so that it doesn't compile
that test.
--
Summary: T const assumed to be compatible with int (A::*) (void)
const
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dodji at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39310
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/39310] T const assumed to be compatible with int (A::*) (void) const
2009-02-26 13:55 [Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const dodji at gcc dot gnu dot org
@ 2009-02-26 16:56 ` jason at gcc dot gnu dot org
2009-02-27 20:08 ` dodji at gcc dot gnu dot org
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-02-26 16:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jason at gcc dot gnu dot org 2009-02-26 16:56 -------
Created an attachment (id=17367)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17367&action=view)
Fix for is_member_function_pointer and GCC
Rather, the test should pass, but we need to fix is_member_function_pointer so
it will still pass without the GCC bug. Patch attached.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39310
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/39310] T const assumed to be compatible with int (A::*) (void) const
2009-02-26 13:55 [Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const dodji at gcc dot gnu dot org
2009-02-26 16:56 ` [Bug libstdc++/39310] " jason at gcc dot gnu dot org
@ 2009-02-27 20:08 ` dodji at gcc dot gnu dot org
2009-03-02 1:47 ` jason at gcc dot gnu dot org
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: dodji at gcc dot gnu dot org @ 2009-02-27 20:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from dodji at gcc dot gnu dot org 2009-02-27 20:08 -------
I have filed bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39321 that
describes the gcc bug. It also has a patch that should fix it.
--
dodji at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |libstdc++
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39310
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/39310] T const assumed to be compatible with int (A::*) (void) const
2009-02-26 13:55 [Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const dodji at gcc dot gnu dot org
2009-02-26 16:56 ` [Bug libstdc++/39310] " jason at gcc dot gnu dot org
2009-02-27 20:08 ` dodji at gcc dot gnu dot org
@ 2009-03-02 1:47 ` jason at gcc dot gnu dot org
2009-03-02 20:09 ` jason at gcc dot gnu dot org
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-03-02 1:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jason at gcc dot gnu dot org 2009-03-02 01:47 -------
The discussion of Core issue 547
(http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#547) suggests that
we ought to be able to write partial specializations of is_function that can
deal with function cv-quals.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39310
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/39310] T const assumed to be compatible with int (A::*) (void) const
2009-02-26 13:55 [Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const dodji at gcc dot gnu dot org
` (2 preceding siblings ...)
2009-03-02 1:47 ` jason at gcc dot gnu dot org
@ 2009-03-02 20:09 ` jason at gcc dot gnu dot org
2009-03-03 8:03 ` paolo dot carlini at oracle dot com
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-03-02 20:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jason at gcc dot gnu dot org 2009-03-02 20:09 -------
Created an attachment (id=17389)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17389&action=view)
New fix that adds function cv-qual handling to is_function, and fixes compiler
to allow that
Here's a fix along those lines.
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #17367|0 |1
is obsolete| |
AssignedTo|unassigned at gcc dot gnu |jason at gcc dot gnu dot org
|dot org |
Status|UNCONFIRMED |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39310
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/39310] T const assumed to be compatible with int (A::*) (void) const
2009-02-26 13:55 [Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const dodji at gcc dot gnu dot org
` (3 preceding siblings ...)
2009-03-02 20:09 ` jason at gcc dot gnu dot org
@ 2009-03-03 8:03 ` paolo dot carlini at oracle dot com
2009-03-03 13:08 ` jason at redhat dot com
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-03-03 8:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from paolo dot carlini at oracle dot com 2009-03-03 08:02 -------
Hi. I'll try to catch up as soon as possible on the details of (the v3 bits of)
this issue, but first blush it seems real strange to me that we cannot
implement anymore the is_member_pointer trait as an OR of the
is_member_object_pointer and the is_member_function_pointer traits. Can I have
a quick "executive report" about the rationale of this part of the proposed
fix?
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |paolo at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39310
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/39310] T const assumed to be compatible with int (A::*) (void) const
2009-02-26 13:55 [Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const dodji at gcc dot gnu dot org
` (4 preceding siblings ...)
2009-03-03 8:03 ` paolo dot carlini at oracle dot com
@ 2009-03-03 13:08 ` jason at redhat dot com
2009-03-03 15:46 ` paolo dot carlini at oracle dot com
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jason at redhat dot com @ 2009-03-03 13:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jason at redhat dot com 2009-03-03 13:08 -------
Subject: Re: T const assumed to be compatible with int
(A::*) (void) const
paolo dot carlini at oracle dot com wrote:
> it seems real strange to me that we cannot
> implement anymore the is_member_pointer trait as an OR of the
> is_member_object_pointer and the is_member_function_pointer traits.
We can still implement it that way; that part of the patch is just an
optimization. I'm can drop it if you prefer.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39310
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/39310] T const assumed to be compatible with int (A::*) (void) const
2009-02-26 13:55 [Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const dodji at gcc dot gnu dot org
` (5 preceding siblings ...)
2009-03-03 13:08 ` jason at redhat dot com
@ 2009-03-03 15:46 ` paolo dot carlini at oracle dot com
2009-03-13 17:39 ` paolo dot carlini at oracle dot com
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-03-03 15:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from paolo dot carlini at oracle dot com 2009-03-03 15:46 -------
Thanks, Jason, now I see it. Then I'm Ok with the patch as-is.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39310
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/39310] T const assumed to be compatible with int (A::*) (void) const
2009-02-26 13:55 [Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const dodji at gcc dot gnu dot org
` (6 preceding siblings ...)
2009-03-03 15:46 ` paolo dot carlini at oracle dot com
@ 2009-03-13 17:39 ` paolo dot carlini at oracle dot com
2009-03-15 1:46 ` jason at gcc dot gnu dot org
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-03-13 17:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from paolo dot carlini at oracle dot com 2009-03-13 17:39 -------
Jason, are you going to commit the is_member-2.patch?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39310
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/39310] T const assumed to be compatible with int (A::*) (void) const
2009-02-26 13:55 [Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const dodji at gcc dot gnu dot org
` (7 preceding siblings ...)
2009-03-13 17:39 ` paolo dot carlini at oracle dot com
@ 2009-03-15 1:46 ` jason at gcc dot gnu dot org
2009-03-15 2:07 ` paolo dot carlini at oracle dot com
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-03-15 1:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jason at gcc dot gnu dot org 2009-03-15 01:45 -------
I was planning to wait until 4.4 branches. If you'd rather have it in 4.4, I
can commit it now.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39310
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/39310] T const assumed to be compatible with int (A::*) (void) const
2009-02-26 13:55 [Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const dodji at gcc dot gnu dot org
` (8 preceding siblings ...)
2009-03-15 1:46 ` jason at gcc dot gnu dot org
@ 2009-03-15 2:07 ` paolo dot carlini at oracle dot com
2009-03-31 18:32 ` jason at gcc dot gnu dot org
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-03-15 2:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from paolo dot carlini at oracle dot com 2009-03-15 02:07 -------
(In reply to comment #9)
> I was planning to wait until 4.4 branches. If you'd rather have it in 4.4, I
> can commit it now.
Well, if you ask me, yes, I would like to see it in 4.4. Thanks in advance.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39310
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/39310] T const assumed to be compatible with int (A::*) (void) const
2009-02-26 13:55 [Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const dodji at gcc dot gnu dot org
` (9 preceding siblings ...)
2009-03-15 2:07 ` paolo dot carlini at oracle dot com
@ 2009-03-31 18:32 ` jason at gcc dot gnu dot org
2009-04-02 14:19 ` dodji at gcc dot gnu dot org
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-03-31 18:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from jason at gcc dot gnu dot org 2009-03-31 18:31 -------
Subject: Bug 39310
Author: jason
Date: Tue Mar 31 18:31:17 2009
New Revision: 145365
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145365
Log:
PR c++/37806
* typeck.c (cp_apply_type_quals_to_decl): Don't apply any quals
to a typedef.
* tree.c (cp_build_qualified_type_real): Don't apply restrict to a
function type.
* decl.h (enum decl_context): Add TEMPLATE_TYPE_ARG.
* decl.c (groktypename): Add is_template_arg parameter.
(grokdeclarator): Allow function cv-quals on a template type arg.
* parser.c (cp_parser_new_type_id, cp_parser_type_id): Add
is_template_arg argument in calls to groktypename.
* cp-tree.h: Adjust prototype.
* error.c (dump_type_prefix, dump_type_suffix): Fix plain
FUNCTION_TYPE printing.
PR libstdc++/39310
* include/tr1_impl/type_traits (is_function): Add partial
specializations with function cv-quals.
(__is_function_helper): Remove.
(is_member_pointer): Don't define in terms of is_member_*_pointer.
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/decl.c
trunk/gcc/cp/decl.h
trunk/gcc/cp/error.c
trunk/gcc/cp/parser.c
trunk/gcc/cp/tree.c
trunk/gcc/cp/typeck.c
trunk/gcc/testsuite/g++.dg/template/qualttp20.C
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/tr1_impl/type_traits
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39310
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/39310] T const assumed to be compatible with int (A::*) (void) const
2009-02-26 13:55 [Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const dodji at gcc dot gnu dot org
` (10 preceding siblings ...)
2009-03-31 18:32 ` jason at gcc dot gnu dot org
@ 2009-04-02 14:19 ` dodji at gcc dot gnu dot org
2009-04-07 4:38 ` jason at gcc dot gnu dot org
2009-04-07 8:52 ` paolo dot carlini at oracle dot com
13 siblings, 0 replies; 15+ messages in thread
From: dodji at gcc dot gnu dot org @ 2009-04-02 14:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from dodji at gcc dot gnu dot org 2009-04-02 14:19 -------
Fixed in trunk (gcc 4.5).
--
dodji at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39310
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/39310] T const assumed to be compatible with int (A::*) (void) const
2009-02-26 13:55 [Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const dodji at gcc dot gnu dot org
` (11 preceding siblings ...)
2009-04-02 14:19 ` dodji at gcc dot gnu dot org
@ 2009-04-07 4:38 ` jason at gcc dot gnu dot org
2009-04-07 8:52 ` paolo dot carlini at oracle dot com
13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-04-07 4:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from jason at gcc dot gnu dot org 2009-04-07 04:38 -------
Subject: Bug 39310
Author: jason
Date: Tue Apr 7 04:38:10 2009
New Revision: 145648
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145648
Log:
* decl.c (grokdeclarator): Reject pointer to qualified function
type.
PR c++/37806, core issue 547
* typeck.c (cp_apply_type_quals_to_decl): Don't apply any quals
to a typedef.
* tree.c (cp_build_qualified_type_real): Don't apply restrict to a
function type.
* decl.h (enum decl_context): Add TEMPLATE_TYPE_ARG.
* decl.c (groktypename): Add is_template_arg parameter.
(grokdeclarator): Allow function cv-quals on a template type arg.
* parser.c (cp_parser_new_type_id, cp_parser_type_id): Add
is_template_arg argument in calls to groktypename.
* cp-tree.h: Adjust prototype.
* error.c (dump_type_prefix, dump_type_suffix): Fix plain
FUNCTION_TYPE printing.
PR libstdc++/39310
* include/tr1_impl/type_traits (is_function): Add partial
specializations with function cv-quals.
(__is_function_helper): Remove.
(is_member_pointer): Don't define in terms of is_member_*_pointer.
Added:
branches/gcc-4_4-branch/gcc/testsuite/g++.dg/other/typedef2.C
- copied unchanged from r145367,
trunk/gcc/testsuite/g++.dg/other/typedef2.C
branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/typedef17.C
- copied unchanged from r145367,
trunk/gcc/testsuite/g++.dg/template/typedef17.C
Modified:
branches/gcc-4_4-branch/gcc/cp/ChangeLog
branches/gcc-4_4-branch/gcc/cp/cp-tree.h
branches/gcc-4_4-branch/gcc/cp/decl.c
branches/gcc-4_4-branch/gcc/cp/decl.h
branches/gcc-4_4-branch/gcc/cp/error.c
branches/gcc-4_4-branch/gcc/cp/parser.c
branches/gcc-4_4-branch/gcc/cp/tree.c
branches/gcc-4_4-branch/gcc/cp/typeck.c
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/qualttp20.C
branches/gcc-4_4-branch/libstdc++-v3/ChangeLog
branches/gcc-4_4-branch/libstdc++-v3/include/tr1_impl/type_traits
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39310
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/39310] T const assumed to be compatible with int (A::*) (void) const
2009-02-26 13:55 [Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const dodji at gcc dot gnu dot org
` (12 preceding siblings ...)
2009-04-07 4:38 ` jason at gcc dot gnu dot org
@ 2009-04-07 8:52 ` paolo dot carlini at oracle dot com
13 siblings, 0 replies; 15+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-07 8:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #14 from paolo dot carlini at oracle dot com 2009-04-07 08:51 -------
Fixed for 4.4.0 too. Thanks Jason.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39310
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2009-04-07 8:52 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-26 13:55 [Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const dodji at gcc dot gnu dot org
2009-02-26 16:56 ` [Bug libstdc++/39310] " jason at gcc dot gnu dot org
2009-02-27 20:08 ` dodji at gcc dot gnu dot org
2009-03-02 1:47 ` jason at gcc dot gnu dot org
2009-03-02 20:09 ` jason at gcc dot gnu dot org
2009-03-03 8:03 ` paolo dot carlini at oracle dot com
2009-03-03 13:08 ` jason at redhat dot com
2009-03-03 15:46 ` paolo dot carlini at oracle dot com
2009-03-13 17:39 ` paolo dot carlini at oracle dot com
2009-03-15 1:46 ` jason at gcc dot gnu dot org
2009-03-15 2:07 ` paolo dot carlini at oracle dot com
2009-03-31 18:32 ` jason at gcc dot gnu dot org
2009-04-02 14:19 ` dodji at gcc dot gnu dot org
2009-04-07 4:38 ` jason at gcc dot gnu dot org
2009-04-07 8:52 ` paolo dot carlini at oracle dot com
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).