Bug 13052 - error in looking up template super classes in different namespace
Summary: error in looking up template super classes in different namespace
Status: RESOLVED DUPLICATE of bug 189
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3.2
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: monitored, rejects-valid
Depends on:
Blocks: 12944
  Show dependency treegraph
 
Reported: 2003-11-14 14:47 UTC by thomas weidner
Modified: 2009-11-18 07:07 UTC (History)
11 users (show)

See Also:
Host: i686-pc-linux-gnu
Target:
Build:
Known to work:
Known to fail: 2.95.3 3.0.4 3.2.3 3.3.3 3.4.0 4.0.0
Last reconfirmed: 2006-09-03 21:39:33


Attachments
file won't compile with gcc (173 bytes, text/plain)
2003-11-14 14:47 UTC, thomas weidner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description thomas weidner 2003-11-14 14:47:05 UTC
Hi,

it seems like gcc has problems looking up the name of a super class, which is in
a different namespace, when you odmit the namespace name. it works with
icc,comeau and vc6. so i consider it as a bug in gcc. tested gcc versions are
3.3.2 and 3.4-20031112. 3.4 built with the default configure parameters. 3.3.2
is gentoo's versions (gcc (GCC) 3.3.2 20031022 (Gentoo Linux 3.3.2-r2,
propolice)). a small program demonstrating the bug wil be appended. gcc output is:
x.cc: In function `int main()':
x.cc:12: error: 'class Y<0>' has no member named 'X'
x.cc:12: error: `::x' undeclared (first use here)
Comment 1 thomas weidner 2003-11-14 14:47:42 UTC
Created attachment 5135 [details]
file won't compile with gcc
Comment 2 Wolfgang Bangerth 2003-11-14 15:00:45 UTC
I can confirm that this program 
------------------------
namespace NS
{
  template <int> struct X { int x;};
}

template<int i> struct Y : NS::X<i> {};


int main()
{
  Y<0> y;
  y.X<0>::x=1;
}
-------------------------------
indeed does not compile. I'm not quite sure that it should, though I
seem to remember that we had another PR that was about something similar:
the name of the base class is supposed to be injected into the namespace
of the class, so this should indeed compile then. I think I even recall
that some kind of DR was associated with this question.

Nathan, do you remember?

W.
Comment 3 Gabriel Dos Reis 2003-11-14 15:51:59 UTC
Subject: Re:  error in looking up template super classes in different namespace

"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| I can confirm that this program 
| ------------------------
| namespace NS
| {
|   template <int> struct X { int x;};
| }
| 
| template<int i> struct Y : NS::X<i> {};
| 
| 
| int main()
| {
|   Y<0> y;
|   y.X<0>::x=1;
| }
| -------------------------------
| indeed does not compile. I'm not quite sure that it should, though I

The code is valid.  .X<0>::x is explicit member access to the
component "x" of the base subobject of type X<0>.

-- Gaby
Comment 4 Andrew Pinski 2003-11-15 02:52:41 UTC
Confirmed by Nathan.
Comment 5 Volker Reichelt 2009-11-18 07:07:51 UTC
This is the same problem as PR 189 which was fixed yesterday.


*** This bug has been marked as a duplicate of 189 ***