[Bug c++/60686] New: message "=?UTF-8?Q?=20only=20declarations=20of=20constructors=20can=20be=20=E2=80=98explicit=E2=80=99=20?=" now conflicting with C++11
a.gronchi at nextworks dot it
gcc-bugzilla@gcc.gnu.org
Thu Mar 27 15:09:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60686
Bug ID: 60686
Summary: message " only declarations of constructors can be
‘explicit’ " now conflicting with C++11
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: a.gronchi at nextworks dot it
The error message:
error: only declarations of constructors can be ‘explicit’
today conflicts with C++11, which also allows conversion operators to be marked
explicit.
Sample code:
struct A {
explicit operator int() const;
};
explicit inline A::operator int() const { return 1; }
Here the second occurrence of the "explicit" keyword is illegal, but the
reported error message leads one to think about GCC lacking support for
explicit conversion operators.
Reproducible with GCC 4.8.2:
Using built-in specs.
COLLECT_GCC=g++-4.8.2
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.2/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-4.8.2-r1/work/gcc-4.8.2/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.2
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.2
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.2/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.2/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/g++-v4
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.8.2/python
--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--enable-checking=release --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo 4.8.2-r1 p1.4-ssptest, pie-0.5.9-ssptest'
--enable-libstdcxx-time --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --enable-multilib
--with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point
--enable-targets=all --disable-libgcj --enable-libgomp --disable-libmudflap
--disable-libssp --enable-lto --without-cloog
Thread model: posix
gcc version 4.8.2 (Gentoo 4.8.2-r1 p1.4-ssptest, pie-0.5.9-ssptest)
More information about the Gcc-bugs
mailing list