public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: bangerth@dealii.org
To: bangerth@ticam.utexas.edu, gcc-bugs@gcc.gnu.org,
gcc-prs@gcc.gnu.org, mark@codesourcery.com, mmitchel@gcc.gnu.org,
nobody@gcc.gnu.org
Subject: Re: c++/9836: [3.4 regression] Error with typdefs in partial specializations of classes
Date: Mon, 24 Feb 2003 21:15:00 -0000 [thread overview]
Message-ID: <20030224211504.13970.qmail@sources.redhat.com> (raw)
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
next reply other threads:[~2003-02-24 21:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-24 21:15 bangerth [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-02-24 21:56 mmitchel
2003-02-24 17:26 bangerth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030224211504.13970.qmail@sources.redhat.com \
--to=bangerth@dealii.org \
--cc=bangerth@ticam.utexas.edu \
--cc=gcc-bugs@gcc.gnu.org \
--cc=gcc-gnats@gcc.gnu.org \
--cc=gcc-prs@gcc.gnu.org \
--cc=mark@codesourcery.com \
--cc=mmitchel@gcc.gnu.org \
--cc=nobody@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).