public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/7218: incorrect 'implicit typename' warnings
@ 2002-07-12 12:56 Ryohei Noda
  0 siblings, 0 replies; 4+ messages in thread
From: Ryohei Noda @ 2002-07-12 12:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/7218; it has been noted by GNATS.

From: "Ryohei Noda" <ndry@mdcplus.com>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, lerdsuwa@gcc.gnu.org,
   nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org, ndry@mdcplus.com
Cc:  
Subject: Re: c++/7218: incorrect 'implicit typename' warnings
Date: Fri, 12 Jul 2002 11:49:16 -0700

 lerdsuwa:
 
 Thank you for your reply.
 But I have not convinced.
 
 The C++ ISO Standard(14882:1998) reads:
 14.6 8(p259) 
 > The lookup of names dependent on the template parameter is 
 > postponed until the actual template argument is known(14.6.2).
 
 Compiler should not complain about failing to look up AA
 when parsing the code.
 
 
 14.6.2 3
 > In the definition of a class template or in the definition of
 > a member of such a template that appears outside of the template
 > definition, if a base class of this template depends on a
 > template-parameter,
 > the base class scope is not examined during name lookup
 > until the class template is instantiated.
 
 The base class scope is examined, 
 after the actual template argument is known and the class template
 (and implicitly the base class template)are instantiated.
 
 
 Have I something misineterpreted?
 
 > Date: 11 Jul 2002 14:50:01 -0000
 > lerdsuwa@gcc.gnu.org Re: c++/7218: incorrect 'implicit typename' warnings
 >Synopsis: incorrect 'implicit typename' warnings
 >
 >State-Changed-From-To: open->closed
 >State-Changed-By: lerdsuwa
 >State-Changed-When: Thu Jul 11 07:50:00 2002
 >State-Changed-Why:
 >    Not a bug.  AA is inside template-parameter dependent
 >    base class.  When parsing class B, names inside A<T>
 >    are not looked up.  You have to write
 >      template<class T>
 >      struct B : A<T> { typename A<T>::AA a;};
 >
 >http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7218
 
 
 ------------------------------------------------------------
 Your Free, Private, Fast, E-mail and WebSite: http://MdCplus.com/email
 Join the MdCplus affiliates program and Make MONEY: http://MdCplus.com/$/?bmb
 
 
 ---------------------------------------------------------------------
 Express yourself with a super cool email address from BigMailBox.com.
 Hundreds of choices. It's free!
 http://www.bigmailbox.com
 ---------------------------------------------------------------------


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

* Re: c++/7218: incorrect 'implicit typename' warnings
@ 2002-07-13  3:26 Kriang Lerdsuwanakij
  0 siblings, 0 replies; 4+ messages in thread
From: Kriang Lerdsuwanakij @ 2002-07-13  3:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/7218; it has been noted by GNATS.

From: Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
To: Ryohei Noda <ndry@mdcplus.com>
Cc: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, lerdsuwa@gcc.gnu.org,
        nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Subject: Re: c++/7218: incorrect 'implicit typename' warnings
Date: Sat, 13 Jul 2002 17:25:07 +0700

 Ryohei Noda wrote:
 > 
 > lerdsuwa:
 > 
 > Thank you for your reply.
 > But I have not convinced.
 > 
 > The C++ ISO Standard(14882:1998) reads:
 > 14.6 8(p259)
 > > The lookup of names dependent on the template parameter is
 > > postponed until the actual template argument is known(14.6.2).
 > 
 > Compiler should not complain about failing to look up AA
 > when parsing the code.
 > 
 > 14.6.2 3
 > > In the definition of a class template or in the definition of
 > > a member of such a template that appears outside of the template
 > > definition, if a base class of this template depends on a
 > > template-parameter,
 > > the base class scope is not examined during name lookup
 > > until the class template is instantiated.
 > 
 > The base class scope is examined,
 > after the actual template argument is known and the class template
 > (and implicitly the base class template)are instantiated.
 > 
 > Have I something misineterpreted?
 
 You're incorrect about whether the name 'AA' is template parameter
 dependent.  Take a look at your code (which is the same as the one 
 in 14.6.2 3 except various name interchange):
 
       template<class T>
       struct B : A<T> { AA a;};
 
 'AA' specified this way is NOT a template parameter dependent name 
 according to 14.6.2.1 1.  This 'AA' must be looked up in the scope 
 that contain the template class 'B'.  But the name is not found.  
 So the code parsing fails and you see the warning message.
 
 To force the compiler to behave like 14.6 8 and 14.6.2 3 you
 mentioned.  You must force GCC to view 'AA' as a dependent name.
 Because base class 'A<T>' is template parameter dependent.  You can
 form a type dependent via 14.6.2.1 1 case 2 (a qualified-id
 with a nested-name-specifier which contains a class-name that
 names a dependent type), i.e. 'typename A<T>::B'.  
 'typename A<T>::B' is a qualified-id.  Its nested-name-specifier is 
 'A<T>'.
 
 --Kriang
 
 > 
 > > Date: 11 Jul 2002 14:50:01 -0000
 > > lerdsuwa@gcc.gnu.org Re: c++/7218: incorrect 'implicit typename' warnings
 > >Synopsis: incorrect 'implicit typename' warnings
 > >
 > >State-Changed-From-To: open->closed
 > >State-Changed-By: lerdsuwa
 > >State-Changed-When: Thu Jul 11 07:50:00 2002
 > >State-Changed-Why:
 > >    Not a bug.  AA is inside template-parameter dependent
 > >    base class.  When parsing class B, names inside A<T>
 > >    are not looked up.  You have to write
 > >      template<class T>
 > >      struct B : A<T> { typename A<T>::AA a;};
 > >
 > >http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7218
 > 
 > ------------------------------------------------------------
 > Your Free, Private, Fast, E-mail and WebSite: http://MdCplus.com/email
 > Join the MdCplus affiliates program and Make MONEY: http://MdCplus.com/$/?bmb
 > 
 > ---------------------------------------------------------------------
 > Express yourself with a super cool email address from BigMailBox.com.
 > Hundreds of choices. It's free!
 > http://www.bigmailbox.com
 > ---------------------------------------------------------------------


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

* Re: c++/7218: incorrect 'implicit typename' warnings
@ 2002-07-11  7:50 lerdsuwa
  0 siblings, 0 replies; 4+ messages in thread
From: lerdsuwa @ 2002-07-11  7:50 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, ndry, nobody

Synopsis: incorrect 'implicit typename' warnings

State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Thu Jul 11 07:50:00 2002
State-Changed-Why:
    Not a bug.  AA is inside template-parameter dependent
    base class.  When parsing class B, names inside A<T>
    are not looked up.  You have to write
      template<class T>
      struct B : A<T> { typename A<T>::AA a;};

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


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

* c++/7218: incorrect 'implicit typename' warnings
@ 2002-07-05 19:16 ndry
  0 siblings, 0 replies; 4+ messages in thread
From: ndry @ 2002-07-05 19:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7218
>Category:       c++
>Synopsis:       incorrect 'implicit typename' warnings
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 05 19:16:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     ndry@mdcplus.com
>Release:        3.1.1 pr
>Organization:
>Environment:
FreeBSD 4.6-STABLE
g++31 (GCC) 3.1.1 20020617 (prerelease) [FreeBSD]
>Description:
The code below(test.cc) is compiled without warnings on g++ 3.0.4.
But on g++ 3.1.1 20020617: 

test.cc:5: warning: `typename B<T>::AA' is implicitly a typename
test.cc:5: warning: implicit typename is deprecated, please see the 
   documentation for details

AA should be lookued up at least when A<T> is instantiated.
>How-To-Repeat:
compile this:

template<class T>
struct A { struct AA {}; };

template<class T>
struct B : A<T> { AA a;};

main(){ B<int> b;};
>Fix:

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


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

end of thread, other threads:[~2002-07-13 10:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-12 12:56 c++/7218: incorrect 'implicit typename' warnings Ryohei Noda
  -- strict thread matches above, loose matches on Subject: below --
2002-07-13  3:26 Kriang Lerdsuwanakij
2002-07-11  7:50 lerdsuwa
2002-07-05 19:16 ndry

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