public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/7433: Class::Constructor accepted
@ 2002-07-29  6:26 akim
  0 siblings, 0 replies; only message in thread
From: akim @ 2002-07-29  6:26 UTC (permalink / raw)
  To: gcc-gnats, debian-gcc


>Number:         7433
>Category:       c++
>Synopsis:       Invoking (template?) ctors as Class::Class is accepted
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          accepts-illegal
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 29 06:26:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Akim Demaille
>Release:        3.1.1 20020606 (Debian prerelease) (Debian testing/unstable)
>Organization:
>Environment:
System: Linux nostromo 2.4.17 #9 Wed Jan 2 19:07:31 CET 2002 i686 unknown
Architecture: i686

	
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: /mnt/data/gcc-3.1/gcc-3.1-3.1.1ds1/src/configure -v --enable-languages=c,c++,java,f77,proto,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/g++-v3-3.1 --enable-shared --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --enable-clocale=gnu --enable-threads=posix --enable-java-gc=boehm --enable-objc-gc i386-linux
>Description:

G++ 3.1 accepts things like the following:

	typedef std::list<int> list_t;
	list_t::list (l.begin (), l.end ());

while it should accept only:

	typedef std::list<int> list_t;
	list_t (l.begin (), l.end ());

Neither Comeau, not icc accept this program:

/tmp % cat -n bar.cc                                             nostromo Err 1
     1  #include <list>
     2
     3  typedef std::list<int> list_t;
     4
     5  int
     6  main ()
     7  {
     8    list_t l;
     9    list_t l2 = list_t::list (l.begin (), l.end ());
    10  }
/tmp % g++-3.1 --version                                         nostromo 15:20
g++-3.1 (GCC) 3.1.1 20020606 (Debian prerelease)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

/tmp % g++-3.1 bar.cc                                            nostromo 15:20
/tmp % g++-3.1 bar.cc -Wall                                      nostromo 15:20
/tmp % g++-3.1 bar.cc -Wall -ansi                                nostromo 15:20
/tmp % como bar.cc                                               nostromo 15:20
Comeau C/C++ 4.3.0 BETA#4 (Jun  9 2002 13:53:15) for Redhat_LINUX_INTEL_ELF
Copyright 1988-2002 Comeau Computing.  All rights reserved.
MODE:non-strict warnings C++

"bar.cc", line 9: error: a constructor or destructor may not have its address
          taken
    list_t l2 = list_t::list (l.begin (), l.end ());
                ^

1 error detected in the compilation of "bar.cc".
/tmp % icc bar.cc                                                nostromo Err 2
bar.cc
bar.cc(9): error: a nonstatic member reference must be relative to a specific object
    list_t l2 = list_t::list (l.begin (), l.end ());
                ^

compilation aborted for bar.cc (code 2)



>How-To-Repeat:
	
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-07-29 13:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-29  6:26 c++/7433: Class::Constructor accepted akim

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