public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9836: [3.4 regression] Error with typdefs in partial specializations of classes
@ 2003-02-24 21:56 mmitchel
  0 siblings, 0 replies; 3+ messages in thread
From: mmitchel @ 2003-02-24 21:56 UTC (permalink / raw)
  To: bangerth, gcc-bugs, gcc-prs, mark, mmitchel

Synopsis: [3.4 regression] Error with typdefs in partial specializations of classes

State-Changed-From-To: analyzed->closed
State-Changed-By: mmitchel
State-Changed-When: Mon Feb 24 21:56:00 2003
State-Changed-Why:
    Fixed in GCC 3.4.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9836


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

* Re: c++/9836: [3.4 regression] Error with typdefs in partial specializations of classes
@ 2003-02-24 21:15 bangerth
  0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2003-02-24 21:15 UTC (permalink / raw)
  To: bangerth, gcc-bugs, gcc-prs, mark, mmitchel, nobody

Synopsis: [3.4 regression] Error with typdefs in partial specializations of classes

Responsible-Changed-From-To: unassigned->mmitchel
Responsible-Changed-By: bangerth
Responsible-Changed-When: Mon Feb 24 21:15:04 2003
Responsible-Changed-Why:
    Mark, this problem appears with your change 1.662->1.663 of
    pt.c, which comes from this patchset:
    2003-02-23  Mark Mitchell  <mark@codesourcery.com>
    
            PR c++/5333
            * cp-tree.h (CLASSTYPE_PRIMARY_TEMPLATE): New macro.
            * parser.c (cp_parser_diagnose_invalid_type_name): Use it.
            * pt.c (instantiate_class_template): Don't try to instantiate
            dependent types.
            (resolve_typename_type): Use CLASSTYPE_PRIMARY_TEMPLATE.
    
    
    If I back out the pt.c change, the program compiles cleanly
    again, so it looks like that's where the problem lies.
    
    For reference: the patch to pt.c is this one:
    ----------------------------
    diff -u -r1.662 -r1.663
    --- pt.c        20 Feb 2003 17:51:43 -0000      1.662
    +++ pt.c        24 Feb 2003 07:43:22 -0000      1.663
    @@ -5151,7 +5151,9 @@
       if (type == error_mark_node)
         return error_mark_node;
    
    -  if (TYPE_BEING_DEFINED (type) || COMPLETE_TYPE_P (type))
    +  if (TYPE_BEING_DEFINED (type)
    +      || COMPLETE_TYPE_P (type)
    +      || dependent_type_p (type))
         return type;
    
       /* Figure out which template is being instantiated.  */
    @@ -11526,6 +11528,10 @@
          to look inside it.  */
       if (only_current_p && !currently_open_class (scope))
         return error_mark_node;
    +  /* If SCOPE is a partial instantiation, it will not have a valid
    +     TYPE_FIELDS list, so use the original template.  */
    +  if (CLASSTYPE_USE_TEMPLATE (scope))
    +    scope = CLASSTYPE_PRIMARY_TEMPLATE_TYPE (scope);
       /* Enter the SCOPE so that name lookup will be resolved as if we
          were in the class definition.  In particular, SCOPE will no
          longer be considered a dependent type.  */
    
    
    A testcase is this:
    ----------------------------------
    template <bool, int> struct X {};
    
    template <bool C>    struct X<C,1> {
        typedef double* type;
        type foo () const;
    };
    
    template <bool C>
    typename X<C,1>::type
    X<C,1>::foo () const {}
    --------------------------
    and it fails with
    g/x> ../../gcc/bin/gcc/cc1plus -quiet y.cc
    y.cc:10: error: prototype for `typename X<C, 1>::type X<C, 1>::foo() const'
       does not match any in class `X<C, 1>'
    y.cc:5: error: candidate is: double* X<C, 1>::foo() const
    y.cc:10: error: template definition of non-template `typename X<C, 1>::type
       X<C, 1>::foo() const'
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Mon Feb 24 21:15:04 2003
State-Changed-Why:
    Reconfirmed.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9836


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

* c++/9836: [3.4 regression] Error with typdefs in partial specializations of classes
@ 2003-02-24 17:26 bangerth
  0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2003-02-24 17:26 UTC (permalink / raw)
  To: gcc-gnats; +Cc: mark


>Number:         9836
>Category:       c++
>Synopsis:       [3.4 regression] Error with typdefs in partial specializations of classes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 24 17:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang Bangerth
>Release:        unknown-1.0
>Organization:
>Environment:
present mainline
>Description:
This broke with a patch that I think must have gone in 
yesterday (2003-02-23):
--------------------------
template <bool, int> struct X {};

template <bool C>    struct X<C,1> {
    typedef double* type;
    type foo () const;
};

template <bool C>
typename X<C,1>::type
X<C,1>::foo () const {}
-------------------------------

deal.II/base> /ticam/bangerth/tmp/build-gcc/gcc-install/bin/gcc -c y.cc
y.cc:10: error: prototype for `typename X<C, 1>::type X<C, 1>::foo() const'
   does not match any in class `X<C, 1>'
y.cc:5: error: candidate is: double* X<C, 1>::foo() const
y.cc:10: error: template definition of non-template `typename X<C, 1>::type
   X<C, 1>::foo() const'

There is only one patch in this timeframe,
2003-02-23  Mark Mitchell  <mark@codesourcery.com>

	PR c++/5333
	* cp-tree.h (CLASSTYPE_PRIMARY_TEMPLATE): New macro.
	* parser.c (cp_parser_diagnose_invalid_type_name): Use it.
	* pt.c (instantiate_class_template): Don't try to instantiate
	dependent types.
	(resolve_typename_type): Use CLASSTYPE_PRIMARY_TEMPLATE.

I'll try to investigate further whether this is the one
that caused the problem, but that will have to wait until
tomorrow, of so. 

Mark, if you spot right away that your patch caused this,
drop me a note so that I can short-cut my efforts on this.

W.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2003-02-24 21:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-24 21:56 c++/9836: [3.4 regression] Error with typdefs in partial specializations of classes mmitchel
  -- strict thread matches above, loose matches on Subject: below --
2003-02-24 21:15 bangerth
2003-02-24 17:26 bangerth

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).