public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/45606]  New: match a method prototyped a typedef alias with the original type (using stdlib)
@ 2010-09-09  2:28 hugo dot arregui at gmail dot com
  2010-09-09  2:28 ` [Bug c++/45606] " hugo dot arregui at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: hugo dot arregui at gmail dot com @ 2010-09-09  2:28 UTC (permalink / raw)
  To: gcc-bugs

I cannot reproduce the error without std.

I wrote an small testcase, wich one I include to make clear the situation.

The code:

#include <list>

template<class T>
class Test
{
    protected:
        typedef std::list<T> ListAlias;
        ListAlias list;
    public:
        typedef typename ListAlias::const_iterator const_iterator;
        inline const_iterator begin() const;

};

template<class T>
inline typename std::list<T>::const_iterator Test<T>::begin() const
{
    return list.begin();
};

The error:

test.cpp:16:46: error: prototype for 'typename std::list<T>::const_iterator
Test<T>::begin() const' does not match any in class 'Test<T>'
test.cpp:11:31: error: candidate is: Test<T>::const_iterator Test<T>::begin()
const

The ii file is really long with the include header, and I think that the
testcase is small.


-- 
           Summary: match a method prototyped a typedef alias with the
                    original type (using stdlib)
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hugo dot arregui at gmail dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45606


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/45606] match a method prototyped a typedef alias with the original type (using stdlib)
  2010-09-09  2:28 [Bug c++/45606] New: match a method prototyped a typedef alias with the original type (using stdlib) hugo dot arregui at gmail dot com
@ 2010-09-09  2:28 ` hugo dot arregui at gmail dot com
  2010-09-09 16:32 ` [Bug c++/45606] [4.5/4.6 Regresssion] " redi at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: hugo dot arregui at gmail dot com @ 2010-09-09  2:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from hugo dot arregui at gmail dot com  2010-09-09 02:28 -------
Created an attachment (id=21745)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21745&action=view)
ii file


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45606


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/45606] [4.5/4.6 Regresssion] match a method prototyped a typedef alias with the original type (using stdlib)
  2010-09-09  2:28 [Bug c++/45606] New: match a method prototyped a typedef alias with the original type (using stdlib) hugo dot arregui at gmail dot com
  2010-09-09  2:28 ` [Bug c++/45606] " hugo dot arregui at gmail dot com
@ 2010-09-09 16:32 ` redi at gcc dot gnu dot org
  2010-09-09 16:56 ` paolo dot carlini at oracle dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-09-09 16:32 UTC (permalink / raw)
  To: gcc-bugs



-- 

redi at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |rejects-valid
      Known to work|                            |4.4.4
   Last reconfirmed|0000-00-00 00:00:00         |2010-09-09 16:31:41
               date|                            |
            Summary|match a method prototyped a |[4.5/4.6 Regresssion] match
                   |typedef alias with the      |a method prototyped a
                   |original type (using stdlib)|typedef alias with the
                   |                            |original type (using stdlib)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45606


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/45606] [4.5/4.6 Regresssion] match a method prototyped a typedef alias with the original type (using stdlib)
  2010-09-09  2:28 [Bug c++/45606] New: match a method prototyped a typedef alias with the original type (using stdlib) hugo dot arregui at gmail dot com
  2010-09-09  2:28 ` [Bug c++/45606] " hugo dot arregui at gmail dot com
  2010-09-09 16:32 ` [Bug c++/45606] [4.5/4.6 Regresssion] " redi at gcc dot gnu dot org
@ 2010-09-09 16:56 ` paolo dot carlini at oracle dot com
  2010-09-09 18:23 ` [Bug c++/45606] [4.5/4.6 Regression] " hjl dot tools at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-09-09 16:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paolo dot carlini at oracle dot com  2010-09-09 16:56 -------
H.J. can you do a binary search on this?


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl dot tools at gmail dot
                   |                            |com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45606


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/45606] [4.5/4.6 Regression] match a method prototyped a typedef alias with the original type (using stdlib)
  2010-09-09  2:28 [Bug c++/45606] New: match a method prototyped a typedef alias with the original type (using stdlib) hugo dot arregui at gmail dot com
                   ` (2 preceding siblings ...)
  2010-09-09 16:56 ` paolo dot carlini at oracle dot com
@ 2010-09-09 18:23 ` hjl dot tools at gmail dot com
  2010-09-10 13:25 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-09-09 18:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hjl dot tools at gmail dot com  2010-09-09 18:23 -------
It is caused by revision 156316:

http://gcc.gnu.org/ml/gcc-cvs/2010-01/msg00784.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at redhat dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45606


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/45606] [4.5/4.6 Regression] match a method prototyped a typedef alias with the original type (using stdlib)
  2010-09-09  2:28 [Bug c++/45606] New: match a method prototyped a typedef alias with the original type (using stdlib) hugo dot arregui at gmail dot com
                   ` (3 preceding siblings ...)
  2010-09-09 18:23 ` [Bug c++/45606] [4.5/4.6 Regression] " hjl dot tools at gmail dot com
@ 2010-09-10 13:25 ` rguenth at gcc dot gnu dot org
  2010-09-10 20:07 ` dodji at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-09-10 13:25 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.5.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45606


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/45606] [4.5/4.6 Regression] match a method prototyped a typedef alias with the original type (using stdlib)
  2010-09-09  2:28 [Bug c++/45606] New: match a method prototyped a typedef alias with the original type (using stdlib) hugo dot arregui at gmail dot com
                   ` (4 preceding siblings ...)
  2010-09-10 13:25 ` rguenth at gcc dot gnu dot org
@ 2010-09-10 20:07 ` dodji at gcc dot gnu dot org
  2010-09-13 15:56 ` rguenth at gcc dot gnu dot org
  2010-09-19 20:33 ` dodji at gcc dot gnu dot org
  7 siblings, 0 replies; 13+ messages in thread
From: dodji at gcc dot gnu dot org @ 2010-09-10 20:07 UTC (permalink / raw)
  To: gcc-bugs



-- 

dodji at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |dodji at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2010-09-09 16:31:41         |2010-09-10 20:06:43
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45606


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/45606] [4.5/4.6 Regression] match a method prototyped a typedef alias with the original type (using stdlib)
  2010-09-09  2:28 [Bug c++/45606] New: match a method prototyped a typedef alias with the original type (using stdlib) hugo dot arregui at gmail dot com
                   ` (5 preceding siblings ...)
  2010-09-10 20:07 ` dodji at gcc dot gnu dot org
@ 2010-09-13 15:56 ` rguenth at gcc dot gnu dot org
  2010-09-19 20:33 ` dodji at gcc dot gnu dot org
  7 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-09-13 15:56 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45606


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/45606] [4.5/4.6 Regression] match a method prototyped a typedef alias with the original type (using stdlib)
  2010-09-09  2:28 [Bug c++/45606] New: match a method prototyped a typedef alias with the original type (using stdlib) hugo dot arregui at gmail dot com
                   ` (6 preceding siblings ...)
  2010-09-13 15:56 ` rguenth at gcc dot gnu dot org
@ 2010-09-19 20:33 ` dodji at gcc dot gnu dot org
  7 siblings, 0 replies; 13+ messages in thread
From: dodji at gcc dot gnu dot org @ 2010-09-19 20:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dodji at gcc dot gnu dot org  2010-09-19 20:33 -------
I rewrote the handling of typedef comparison to put canonical type comparison
back. I believe this approach is simpler and happens to fix this issue.

A candidate patch was sent to
http://gcc.gnu.org/ml/gcc-patches/2010-09/msg01525.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45606


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/45606] [4.5/4.6 Regression] match a method prototyped a typedef alias with the original type (using stdlib)
       [not found] <bug-45606-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2010-12-16 13:07 ` rguenth at gcc dot gnu.org
@ 2011-02-27 23:13 ` bangerth at gmail dot com
  3 siblings, 0 replies; 13+ messages in thread
From: bangerth at gmail dot com @ 2011-02-27 23:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45606

Wolfgang Bangerth <bangerth at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at gmail dot com

--- Comment #8 from Wolfgang Bangerth <bangerth at gmail dot com> 2011-02-27 22:52:54 UTC ---
If this is fixed in 4.6, shouldn't the bug summary be adjusted to make this
clear?


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/45606] [4.5/4.6 Regression] match a method prototyped a typedef alias with the original type (using stdlib)
       [not found] <bug-45606-4@http.gcc.gnu.org/bugzilla/>
  2010-11-02 12:44 ` dodji at gcc dot gnu.org
  2010-11-02 13:04 ` dodji at gcc dot gnu.org
@ 2010-12-16 13:07 ` rguenth at gcc dot gnu.org
  2011-02-27 23:13 ` bangerth at gmail dot com
  3 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-16 13:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45606

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.5.2                       |4.5.3

--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-16 13:02:50 UTC ---
GCC 4.5.2 is being released, adjusting target milestone.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/45606] [4.5/4.6 Regression] match a method prototyped a typedef alias with the original type (using stdlib)
       [not found] <bug-45606-4@http.gcc.gnu.org/bugzilla/>
  2010-11-02 12:44 ` dodji at gcc dot gnu.org
@ 2010-11-02 13:04 ` dodji at gcc dot gnu.org
  2010-12-16 13:07 ` rguenth at gcc dot gnu.org
  2011-02-27 23:13 ` bangerth at gmail dot com
  3 siblings, 0 replies; 13+ messages in thread
From: dodji at gcc dot gnu.org @ 2010-11-02 13:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45606

--- Comment #6 from Dodji Seketeli <dodji at gcc dot gnu.org> 2010-11-02 13:04:30 UTC ---
This is fixed in 4.6.

For 4.5, I think committing this "as is" is far too risky so I'd wait to see
how "solid" it is for 4.6 and see if I can safely backport this into 4.5 then.

In the mean time I'll see if I can come up with a less risky fix for 4.5.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/45606] [4.5/4.6 Regression] match a method prototyped a typedef alias with the original type (using stdlib)
       [not found] <bug-45606-4@http.gcc.gnu.org/bugzilla/>
@ 2010-11-02 12:44 ` dodji at gcc dot gnu.org
  2010-11-02 13:04 ` dodji at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: dodji at gcc dot gnu.org @ 2010-11-02 12:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45606

--- Comment #5 from Dodji Seketeli <dodji at gcc dot gnu.org> 2010-11-02 12:44:23 UTC ---
Author: dodji
Date: Tue Nov  2 12:44:19 2010
New Revision: 166179

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166179
Log:
Restore canonical type comparison for dependent type(def)s

This patch restores canonical type comparison for dependent types and
then dependent typedefs. After this patch, two template type
parameters T are equal if they have the same index, level, *and*
number of sibling parameters. The novelty is to take in account the
number of sibling parameters.

To do this we first build the template parameters w/o taking in
account their number of siblings. When we know the number of template
parameters we fix up each template parameter with the number of
slibling parameters and we build the appropriate canonical types
accordingly. The patch fixes the fallouts deemed necessary.

This fixes PR c++/45606 but actually fixes all the previous bugs
related to dependent typedef comparison we had since we started to
properly representing dependent typedefs.

gcc/cp/ChangeLog:
    PR c++/45606
    * cp-tree.h (TEMPLATE_TYPE_PARM_SIBLING_PARMS): Remove.
    (struct template_parm_index_s)<num_siblings>: New field.
    (TEMPLATE_PARM_NUM_SIBLINGS): New accessor.
    (process_template_parm): Extend the API to accept the number of
    template parms in argument.
    (cp_set_underlying_type): Remove this.
    * class.c (build_self_reference): Require canonical type equality
    back on the self reference of class.
    * decl2.c (grokfield): Require canonical type equality back on
    typedef class fields.
    * name-lookup.c (pushdecl_maybe_friend): Require canonical type
    equality back on typedefs.
    * parser.c (cp_parser_template_parameter_list): Do not require
    canonical type equality on dependent types created during
    template parameters parsing.
    * pt.c (fixup_template_type_parm_type, fixup_template_parm_index)
    (fixup_template_parm, fixup_template_parms): New private
    functions.
    (current_template_args): Declare this.
    (process_template_parm): Pass the total number of template parms
    to canonical_type_parameter.
    (build_template_parm_index): Add a new argument to carry the total
    number of template parms.
    (reduce_template_parm_level, process_template_parm, make_auto): Adjust.
    (current_template_args): Fix this for template template
    parameters.
    (tsubst_template_parm): Split out of ...
    (tsubst_template_parms): ... this.
    (reduce_template_parm_level): Don't loose
    TEMPLATE_PARM_NUM_SIBLINGS when cloning a TEMPLATE_PARM_INDEX.
    (template_parm_to_arg): Extracted this function from
    current_template_args. Make it represent invalid template parms
    with an error_mark_node instead of a LIST_TREE containing an
    error_mark_node.
    (current_template_args): Use template_parm_to_arg.
    (dependent_template_arg_p): Consider an invalid template argument
    as dependent.
    (end_template_parm_list): Do not update template sibling parms
    here anymore. Use fixup_template_parms instead.
    (process_template_parm): Pass the number of template parms to
    canonical_type_parameter.
    (make_auto): Require structural equality on auto
    TEMPLATE_TYPE_PARM for now.
    (unify)<BOUND_TEMPLATE_TEMPLATE_PARM>: Coerce template parameters
    using all the arguments deduced so far.
    (tsubst)<TEMPLATE_TYPE_PARM>: Pass the number of sibling parms to
    canonical_type_parameter.
    * tree.c (cp_set_underlying_type): Remove.
    * typeck.c (get_template_parms_of_dependent_type)
    (incompatible_dependent_types_p): Remove.
    (structural_comptypes): Do not call incompatible_dependent_types_p
    anymore.
    (comp_template_parms_position): Re-organized. Take the length of
    template parms list in account.

gcc/testsuite/ChangeLog:
    PR c++/45606
    * g++.dg/template/typedef36.C: New test.
    * gcc/testsuite/g++.dg/template/canon-type-9.C: Likewise.
    * g++.dg/template/canon-type-10.C: Likewise.
    * g++.dg/template/canon-type-11.C: Likewise.
    * g++.dg/template/canon-type-12.C: Likewise.
    * g++.dg/template/canon-type-13.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/template/canon-type-10.C
    trunk/gcc/testsuite/g++.dg/template/canon-type-11.C
    trunk/gcc/testsuite/g++.dg/template/canon-type-12.C
    trunk/gcc/testsuite/g++.dg/template/canon-type-13.C
    trunk/gcc/testsuite/g++.dg/template/canon-type-9.C
    trunk/gcc/testsuite/g++.dg/template/typedef36.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/class.c
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/decl2.c
    trunk/gcc/cp/name-lookup.c
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/tree.c
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-02-27 22:53 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-09  2:28 [Bug c++/45606] New: match a method prototyped a typedef alias with the original type (using stdlib) hugo dot arregui at gmail dot com
2010-09-09  2:28 ` [Bug c++/45606] " hugo dot arregui at gmail dot com
2010-09-09 16:32 ` [Bug c++/45606] [4.5/4.6 Regresssion] " redi at gcc dot gnu dot org
2010-09-09 16:56 ` paolo dot carlini at oracle dot com
2010-09-09 18:23 ` [Bug c++/45606] [4.5/4.6 Regression] " hjl dot tools at gmail dot com
2010-09-10 13:25 ` rguenth at gcc dot gnu dot org
2010-09-10 20:07 ` dodji at gcc dot gnu dot org
2010-09-13 15:56 ` rguenth at gcc dot gnu dot org
2010-09-19 20:33 ` dodji at gcc dot gnu dot org
     [not found] <bug-45606-4@http.gcc.gnu.org/bugzilla/>
2010-11-02 12:44 ` dodji at gcc dot gnu.org
2010-11-02 13:04 ` dodji at gcc dot gnu.org
2010-12-16 13:07 ` rguenth at gcc dot gnu.org
2011-02-27 23:13 ` bangerth at gmail 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).