public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: akim@epita.fr
To: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org
Subject: c++/7433: Class::Constructor accepted
Date: Mon, 29 Jul 2002 06:26:00 -0000	[thread overview]
Message-ID: <E17ZAVE-0000MV-00@nostromo.lrde.epita.fr> (raw)


>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:


                 reply	other threads:[~2002-07-29 13:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=E17ZAVE-0000MV-00@nostromo.lrde.epita.fr \
    --to=akim@epita.fr \
    --cc=debian-gcc@lists.debian.org \
    --cc=gcc-gnats@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).