public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13095] New: GCC accepts invalid using declaration
@ 2003-11-18  0:13 reichelt at gcc dot gnu dot org
  2003-11-18  2:17 ` [Bug c++/13095] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2003-11-18  0:13 UTC (permalink / raw)
  To: gcc-bugs

The following code in invalid IMHO, since using declarations shall refer to
members of base classes (according to [7.3.3]/4), but B<T> is not a base class.

===========================================
template <typename> struct A
{
    int i;
};

template <typename T> struct B : A<T>
{
    using B<T>::i;
    int foo() { return i; }
};
===========================================

However, gcc accepts the code since at least 2.95.x.

-- 
           Summary: GCC accepts invalid using declaration
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/13095] GCC accepts invalid using declaration
  2003-11-18  0:13 [Bug c++/13095] New: GCC accepts invalid using declaration reichelt at gcc dot gnu dot org
@ 2003-11-18  2:17 ` pinskia at gcc dot gnu dot org
  2003-11-18 20:12 ` bangerth at dealii dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-18  2:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-18 02:16 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-18 02:16:53
               date|                            |


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


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

* [Bug c++/13095] GCC accepts invalid using declaration
  2003-11-18  0:13 [Bug c++/13095] New: GCC accepts invalid using declaration reichelt at gcc dot gnu dot org
  2003-11-18  2:17 ` [Bug c++/13095] " pinskia at gcc dot gnu dot org
@ 2003-11-18 20:12 ` bangerth at dealii dot org
  2004-01-24 11:23 ` giovannibajo at libero dot it
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2003-11-18 20:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2003-11-18 20:12 -------
The code seems illegal, indeed. Here's what icc says:

g/x> icc -c x.cc -Xc -ansi
x.cc(8): error: invalid base class
      using B<T>::i;
            ^

x.cc(9): error: identifier "i" is undefined
      int foo() { return i; }
                         ^

compilation aborted for x.cc (code 2)

-- 


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


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

* [Bug c++/13095] GCC accepts invalid using declaration
  2003-11-18  0:13 [Bug c++/13095] New: GCC accepts invalid using declaration reichelt at gcc dot gnu dot org
  2003-11-18  2:17 ` [Bug c++/13095] " pinskia at gcc dot gnu dot org
  2003-11-18 20:12 ` bangerth at dealii dot org
@ 2004-01-24 11:23 ` giovannibajo at libero dot it
  2004-06-18  4:49 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: giovannibajo at libero dot it @ 2004-01-24 11:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-01-24 11:23 -------
The bug is actually interesting because [namespace.udecl]/4 says: "A using-
declaration used as a member-declaration shall refer to a member of a base 
class of the class being defined". Most vendors seem to interpret it in a way 
to make the code invalid, but notice that "B<T>::i" is a perfectly well-formed 
way to refer to a member of a base class. Uhm.

-- 


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


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

* [Bug c++/13095] GCC accepts invalid using declaration
  2003-11-18  0:13 [Bug c++/13095] New: GCC accepts invalid using declaration reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-01-24 11:23 ` giovannibajo at libero dot it
@ 2004-06-18  4:49 ` pinskia at gcc dot gnu dot org
  2004-09-20  0:55 ` pinskia at gcc dot gnu dot org
  2005-06-09  7:27 ` reichelt at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-18  4:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-18 04:49 -------
So is this invalid or valid code? Anyone knows?

-- 


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


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

* [Bug c++/13095] GCC accepts invalid using declaration
  2003-11-18  0:13 [Bug c++/13095] New: GCC accepts invalid using declaration reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-06-18  4:49 ` pinskia at gcc dot gnu dot org
@ 2004-09-20  0:55 ` pinskia at gcc dot gnu dot org
  2005-06-09  7:27 ` reichelt at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-20  0:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-20 00:55 -------
Did we decide we was right?

-- 


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


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

* [Bug c++/13095] GCC accepts invalid using declaration
  2003-11-18  0:13 [Bug c++/13095] New: GCC accepts invalid using declaration reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-09-20  0:55 ` pinskia at gcc dot gnu dot org
@ 2005-06-09  7:27 ` reichelt at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-06-09  7:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-06-09 07:27 -------
Fixed on mainline by Nathan's patch for PR19497.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.1.0


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


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

end of thread, other threads:[~2005-06-09  7:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-18  0:13 [Bug c++/13095] New: GCC accepts invalid using declaration reichelt at gcc dot gnu dot org
2003-11-18  2:17 ` [Bug c++/13095] " pinskia at gcc dot gnu dot org
2003-11-18 20:12 ` bangerth at dealii dot org
2004-01-24 11:23 ` giovannibajo at libero dot it
2004-06-18  4:49 ` pinskia at gcc dot gnu dot org
2004-09-20  0:55 ` pinskia at gcc dot gnu dot org
2005-06-09  7:27 ` reichelt at gcc dot gnu dot org

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