Hi,
While compiling program below, behavior of g++ differs from Intel and aCC HP
compilers.
g++ detects error.
Any suggestions?
Is there any option in g++ that allows to compile this program?
Thanks
// -----------------------
// File test2.cpp (BEGIN)
// --------
class noncopyable
{
protected:
noncopyable() {}
~noncopyable() {}
private:
noncopyable( const noncopyable& );
const noncopyable& operator=3D( const noncopyable& );
};
// --------------
class Foo : private noncopyable
{
public:
Foo (){}
};
// -------------
static Foo func1()
{
return Foo();
}
// --------------
int main()
{
return 0;
}
// File test2.cpp (END)
-------------------------
Compilers:
Intel compiler:
> icpc -V
Intel(R) C++ Intel(R) 64 Compiler XE for applications running on
Intel(R) 64, Version 12.0.4.191 Build 20110427
Copyright (C) 1985-2011 Intel Corporation. All rights reserved.
aCC HP compiler:
> aCC -V
aCC: HP C/aC++ B3910B A.06.25.01 [May 16 2010]
GNU g++ compiler:
> g++ -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=3D/usr --mandir=3D/usr/share/man --
infodir=3D/usr/share/info --enable-shared --enable-threads=3Dposix --
enable-checking=3Drelease --with-system-zlib --enable-__cxa_atexit --
disable-libunwind-exceptions --enable-libgcj-multifile --enable-
languages=3Dc,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=3Dgtk --
disable-dssi --disable-plugin --with-java-home=3D/usr/lib/jvm/java-1.4.2-
gcj-1.4.2.0/jre --with-cpu=3Dgeneric --host=3Dx86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)
-------------------------
Compilation.
> icpc test2.cpp
// No errors
> aCC test2.cpp
// No errors
> g++ test2.cpp
test2.cpp: In copy constructor Foo::Foo(const Foo&):
test2.cpp:11: error: noncopyable::noncopyable(const noncopyable&) is
private
test2.cpp:17: error: within this context
test2.cpp: In function Foo func1():
test2.cpp:25: note: synthesized method Foo::Foo(const Foo&) first
required here
This message and the information contained herein is proprietary and
confidential and subject to the Amdocs policy statement,
you may review at http://www.amdocs.com/email_disclaimer.asp
_______________________________________________
help-gplusplus mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-gplusplus