public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56090] New: Injected-class-name treated as constructor name
@ 2013-01-23 21:32 klemensbaum at gmail dot com
  2013-01-23 21:41 ` [Bug c++/56090] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: klemensbaum at gmail dot com @ 2013-01-23 21:32 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56090
           Summary: Injected-class-name treated as constructor name
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: klemensbaum@gmail.com


should compile, see ISO/IEC 14882:2011 §9.0.2


$ cat test.cpp
struct foo { foo::foo::foo::foo::foo::foo* bar; };

$ g++ test.cpp 
test.cpp:1:14: error: ‘foo::foo’ names the constructor, not the type

$ g++ -v
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.1/g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.7.1/work/gcc-4.7.1/configure
--prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.1
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.1
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.1/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.1/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-fixed-point --without-ppl --without-cloog --enable-lto --enable-nls
--without-included-gettext --with-system-zlib --enable-obsolete
--disable-werror --enable-secureplt --enable-multilib
--with-multilib-list=m32,m64 --enable-libmudflap --disable-libssp
--enable-libgomp
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.7.1/python
--enable-checking=release --disable-libgcj --enable-languages=c,c++,fortran
--enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/
--with-pkgversion='Gentoo 4.7.1 p1.0, pie-0.5.3'
Thread model: posix
gcc version 4.7.1 (Gentoo 4.7.1 p1.0, pie-0.5.3)


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

* [Bug c++/56090] Injected-class-name treated as constructor name
  2013-01-23 21:32 [Bug c++/56090] New: Injected-class-name treated as constructor name klemensbaum at gmail dot com
@ 2013-01-23 21:41 ` pinskia at gcc dot gnu.org
  2013-01-23 21:44 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-01-23 21:41 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-01-23 21:41:16 UTC ---
This is related to bug 11764 and C++ defect report #147.


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

* [Bug c++/56090] Injected-class-name treated as constructor name
  2013-01-23 21:32 [Bug c++/56090] New: Injected-class-name treated as constructor name klemensbaum at gmail dot com
  2013-01-23 21:41 ` [Bug c++/56090] " pinskia at gcc dot gnu.org
@ 2013-01-23 21:44 ` pinskia at gcc dot gnu.org
  2013-01-23 22:32 ` klemensbaum at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-01-23 21:44 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-01-23 21:44:07 UTC ---
My reading of DR 147, makes this invalid code as foo::foo names the
constructor.


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

* [Bug c++/56090] Injected-class-name treated as constructor name
  2013-01-23 21:32 [Bug c++/56090] New: Injected-class-name treated as constructor name klemensbaum at gmail dot com
  2013-01-23 21:41 ` [Bug c++/56090] " pinskia at gcc dot gnu.org
  2013-01-23 21:44 ` pinskia at gcc dot gnu.org
@ 2013-01-23 22:32 ` klemensbaum at gmail dot com
  2021-08-07 23:14 ` pinskia at gcc dot gnu.org
  2021-08-09  9:49 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: klemensbaum at gmail dot com @ 2013-01-23 22:32 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Klemens <klemensbaum at gmail dot com> 2013-01-23 22:32:47 UTC ---
I would argue that in 3.4.3.1.2 the constructor is not an acceptable lookup
result, since it would result in the code being invalid.


Additionally, the following use of a type alias (where the constructor is
clearly not an acceptable lookup result) does not compile on my g++-4.7.1:
struct foo { using bar = foo::foo::foo; };


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

* [Bug c++/56090] Injected-class-name treated as constructor name
  2013-01-23 21:32 [Bug c++/56090] New: Injected-class-name treated as constructor name klemensbaum at gmail dot com
                   ` (2 preceding siblings ...)
  2013-01-23 22:32 ` klemensbaum at gmail dot com
@ 2021-08-07 23:14 ` pinskia at gcc dot gnu.org
  2021-08-09  9:49 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-07 23:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56090

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC, clang, ICC and MSVC all say this is not a bug and the name is a
constructor name in this context.

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

* [Bug c++/56090] Injected-class-name treated as constructor name
  2013-01-23 21:32 [Bug c++/56090] New: Injected-class-name treated as constructor name klemensbaum at gmail dot com
                   ` (3 preceding siblings ...)
  2021-08-07 23:14 ` pinskia at gcc dot gnu.org
@ 2021-08-09  9:49 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-09  9:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56090

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This was clarified by Core DR 1310 https://wg21.link/cwg1310

foo::foo names the constructor, and so can only be used to declare the
constructor as a friend, or in a using-declaration for inheriting constructors.

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

end of thread, other threads:[~2021-08-09  9:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-23 21:32 [Bug c++/56090] New: Injected-class-name treated as constructor name klemensbaum at gmail dot com
2013-01-23 21:41 ` [Bug c++/56090] " pinskia at gcc dot gnu.org
2013-01-23 21:44 ` pinskia at gcc dot gnu.org
2013-01-23 22:32 ` klemensbaum at gmail dot com
2021-08-07 23:14 ` pinskia at gcc dot gnu.org
2021-08-09  9:49 ` redi at gcc dot gnu.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).