[Bug c++/56697] New: Erroneous rejection of use of private constructor in public method
nmm1 at cam dot ac.uk
gcc-bugzilla@gcc.gnu.org
Sat Mar 23 12:37:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56697
Bug #: 56697
Summary: Erroneous rejection of use of private constructor in
public method
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: nmm1@cam.ac.uk
What I believe is an erroneous rejection of a program. Unfortunately, the
C++ standard is too contorted in this area for me to be absolutely sure,
Anyway, Intel is happy with it.
wheeler$cat junk.cpp
class weeble {
public:
weeble () {}
class wurble {
int n;
wurble (int k) : n(k) {}
public:
wurble () : n(0) {}
};
wurble fred (int k) {return wurble(k);}
};
int main () {
weeble a;
weeble::wurble b = a.fred(42);
}
wheeler$/home/nmm/GCC/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/home/nmm/GCC/bin/g++
COLLECT_LTO_WRAPPER=/home/nmm/GCC/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.8-20130127/configure --prefix=/home/nmm/GCC
--disable-bootstrap --enable-checking=all --enable-languages=c,c++,fortran :
(reconfigured) ../gcc-4.8-20130127/configure --prefix=/home/nmm/GCC
--disable-bootstrap --enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.8.0 20130127 (experimental) (GCC)
wheeler$/home/nmm/GCC/bin/g++ junk.cpp
junk.cpp: In member function 'weeble::wurble weeble::fred(int)':
junk.cpp:6:9: error: 'weeble::wurble::wurble(int)' is private
wurble (int k) : n(k) {}
^
junk.cpp:10:41: error: within this context
wurble fred (int k) {return wurble(k);}
^
More information about the Gcc-bugs
mailing list