[Bug c++/57063] Valid static_cast from data member to rvalue reference fails to compile
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57063 --- Comment #2 from Nikolka tsoae at mail dot ru 2013-04-25 07:19:20 UTC --- The alias is added for convenience - we can quickly test handling of different types so. It seems that there is no problem with class types and function types, the error arises when T is a scalar type or an array type: #include string template class T struct X { T f() { return static_castT (value); } T value; }; enum E {}; template class Xint; template class XE; template class Xstd::string; template class Xint(); template class Xint[1]; test.cpp: In instantiation of ‘T XT::f() [with T = int]’: test.cpp:15:20: required from here test.cpp:8:43: error: cannot bind ‘int’ lvalue to ‘int’ return static_castT (value); ^ test.cpp: In instantiation of ‘T XT::f() [with T = E]’: test.cpp:16:20: required from here test.cpp:8:43: error: cannot bind ‘E’ lvalue to ‘E’ test.cpp: In instantiation of ‘T XT::f() [with T = int [1]]’: test.cpp:19:20: required from here test.cpp:8:43: error: cannot bind ‘int [1]’ lvalue to ‘int ()[1]’
[Bug c++/57063] Valid static_cast from data member to rvalue reference fails to compile
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57063 --- Comment #4 from Nikolka tsoae at mail dot ru 2013-04-25 13:51:21 UTC --- It looks like the root of the issue is that static_cast produces an expression with wrong value category sometimes. #include iostream #include type_traits #define PRINT_VALUE(...) \ std::cout #__VA_ARGS__ = __VA_ARGS__ std::endl template class T struct X { void f() { PRINT_VALUE(std::is_lvalue_reference decltype(static_castT (value)){}); PRINT_VALUE(std::is_rvalue_reference decltype(static_castT (value)){}); std::cout std::endl; } T value; }; struct A {}; int main() { Xint{0}.f(); XA{A()}.f(); } When T = int, static_castT (value) is wrongfully treated as an lvalue. In the first example the compiler thinks that we want to return lvalue of type int by rvalue reference int , which would be invalid.
[Bug c++/57063] New: Valid static_cast from data member to rvalue reference fails to compile
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57063 Bug #: 57063 Summary: Valid static_cast from data member to rvalue reference fails to compile Classification: Unclassified Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ts...@mail.ru G++ 4.8-20130418 fails to compile the following well-formed code: using T = int; struct X { T f() { return static_castT (value); } T value; }; int main() {} It issues the following error at the line with static_cast: cannot bind ‘T {aka int}’ lvalue to ‘T {aka int}’ return static_castT (value); Command line: g++ test.cpp -std=c++11 -pedantic -v Output: == Using built-in specs. COLLECT_GCC=../builds/gcc-4.8-20130418/target/bin/g++ COLLECT_LTO_WRAPPER=../builds/gcc-4.8-20130418/target/libexec/gcc/i686-pc-linux-gnu/4.8.1/lto-wrapper Target: i686-pc-linux-gnu Configured with: ../Downloads/gcc_install/gcc-4.8-20130418/configure --prefix=../builds/gcc-4.8-20130418/target --enable-languages=c,c++ --disable-werror Thread model: posix gcc version 4.8.1 20130418 (prerelease) (GCC) COLLECT_GCC_OPTIONS='-std=c++11' '-Wpedantic' '-v' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' ../builds/gcc-4.8-20130418/target/libexec/gcc/i686-pc-linux-gnu/4.8.1/cc1plus -quiet -v -D_GNU_SOURCE test.cpp -quiet -dumpbase test.cpp -mtune=generic -march=pentiumpro -auxbase test -Wpedantic -std=c++11 -version -o /tmp/cc8uNbtW.s GNU C++ (GCC) version 4.8.1 20130418 (prerelease) (i686-pc-linux-gnu) compiled by GNU C version 4.8.1 20130418 (prerelease), GMP version 5.1.1, MPFR version 3.1.2, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory ../builds/gcc-4.8-20130418/target/lib/gcc/i686-pc-linux-gnu/4.8.1/../../../../i686-pc-linux-gnu/include #include ... search starts here: #include ... search starts here: ../builds/gcc-4.8-20130418/target/lib/gcc/i686-pc-linux-gnu/4.8.1/../../../../include/c++/4.8.1 ../builds/gcc-4.8-20130418/target/lib/gcc/i686-pc-linux-gnu/4.8.1/../../../../include/c++/4.8.1/i686-pc-linux-gnu ../builds/gcc-4.8-20130418/target/lib/gcc/i686-pc-linux-gnu/4.8.1/../../../../include/c++/4.8.1/backward ../builds/gcc-4.8-20130418/target/lib/gcc/i686-pc-linux-gnu/4.8.1/include /usr/local/include ../builds/gcc-4.8-20130418/target/include ../builds/gcc-4.8-20130418/target/lib/gcc/i686-pc-linux-gnu/4.8.1/include-fixed /usr/include End of search list. GNU C++ (GCC) version 4.8.1 20130418 (prerelease) (i686-pc-linux-gnu) compiled by GNU C version 4.8.1 20130418 (prerelease), GMP version 5.1.1, MPFR version 3.1.2, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 0f47b9d9fd89a439a6a420b23c88ecfa test.cpp: In member function ‘T X::f()’: test.cpp:7:39: error: cannot bind ‘T {aka int}’ lvalue to ‘T {aka int}’ return static_castT (value); ^
[Bug c++/56192] New: global operator new() vs member operator new()
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56192 Bug #: 56192 Summary: global operator new() vs member operator new() Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ts...@mail.ru g++ 4.8.0 20130127 fails to compile the following code #include cstddef template class struct A {}; template class T Adecltype(new T) f(int); template class T Adecltype(::new T) g(int); struct X { void *operator new(std::size_t n, void *); }; int main() { using type = decltype(gX(0)); } = Using built-in specs. COLLECT_GCC=bin/g++ COLLECT_LTO_WRAPPER=libexec/gcc/x86_64-linux-gnu/4.8.0/lto-wrapper Target: x86_64-linux-gnu Configured with: ../gcc-4.8-20130127/configure --prefix=/mnt/compiles/toolchains/cpp/4.8.0 --disable-nls --enable-languages=c,c++,go,fortran --enable-shared --enable-linker-build-id --with-system-zlib --without-included-gettext --enable-threads=posix --enable-clocale=gnu --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-bootstrap --disable-multilib --disable-shared --enable-static Thread model: posix gcc version 4.8.0 20130127 (experimental) (GCC) COLLECT_GCC_OPTIONS='-std=c++11' '-v' '-o' 'program' '-mtune=generic' '-march=x86-64' libexec/gcc/x86_64-linux-gnu/4.8.0/cc1plus -quiet -v -imultilib . -imultiarch x86_64-linux-gnu -D_GNU_SOURCE source.cpp -quiet -dumpbase source.cpp -mtune=generic -march=x86-64 -auxbase source -std=c++11 -version -o /tmp/ccKToF0B.s GNU C++ (GCC) version 4.8.0 20130127 (experimental) (x86_64-linux-gnu) compiled by GNU C version 4.7.2, GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory /usr/local/include/x86_64-linux-gnu ignoring nonexistent directory lib/gcc/x86_64-linux-gnu/4.8.0/../../../../x86_64-linux-gnu/include #include ... search starts here: #include ... search starts here: lib/gcc/x86_64-linux-gnu/4.8.0/../../../../include/c++/4.8.0 lib/gcc/x86_64-linux-gnu/4.8.0/../../../../include/c++/4.8.0/x86_64-linux-gnu/. lib/gcc/x86_64-linux-gnu/4.8.0/../../../../include/c++/4.8.0/backward lib/gcc/x86_64-linux-gnu/4.8.0/include /usr/local/include include lib/gcc/x86_64-linux-gnu/4.8.0/include-fixed x86_64-linux-gnu /usr/include End of search list. GNU C++ (GCC) version 4.8.0 20130127 (experimental) (x86_64-linux-gnu) compiled by GNU C version 4.7.2, GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: c50b4a9e751f2a9ab933b25f6962a9bf source.cpp: In function 'int main()': source.cpp:19:33: error: no matching function for call to 'g(int)' using type = decltype(gX(0)); ^ source.cpp:19:33: note: candidate is: source.cpp:10:26: note: templateclass T Adecltype (new T) g(int) Adecltype(::new T) g(int); ^ source.cpp:10:26: note: template argument deduction/substitution failed: source.cpp: In substitution of 'templateclass T Adecltype (new T) g(int) [with T = missing]': source.cpp:19:33: required from here source.cpp:10:26: error: no matching function for call to 'X::operator new(sizetype)' source.cpp:10:26: note: candidate is: source.cpp:14:11: note: static void* X::operator new(std::size_t, void*) void *operator new(std::size_t n, void *); ^ source.cpp:14:11: note: candidate expects 2 arguments, 1 provided source.cpp:19:33: error: no matching function for call to 'g(int)' using type = decltype(gX(0)); ^ source.cpp:19:33: note: candidate is: source.cpp:10:26: note: templateclass T Adecltype (new T) g(int) Adecltype(::new T) g(int); ^ source.cpp:10:26: note: template argument deduction/substitution failed: source.cpp: In substitution of 'templateclass T Adecltype (new T) g(int) [with T = missing]': source.cpp:19:33: required from here source.cpp:10:26: error: no matching function for call to 'X::operator new(sizetype)' source.cpp:10:26: note: candidate is: source.cpp:14:11: note: static void* X::operator new(std::size_t, void*) void *operator new(std::size_t n, void *); ^ source.cpp:14:11: note: candidate expects 2 arguments, 1 provided = The
[Bug c++/54506] Defaulted move constructors and move assignment operators are erroneously defined as deleted
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54506 --- Comment #8 from Nikolka tsoae at mail dot ru 2012-09-10 06:26:02 UTC --- (In reply to comment #7) (In reply to comment #3) g++ v4.7.2 20120908 (prerelease) compiles the original example successfully, but it fails to compile the following code: G++ is following the proposed resolution of DR 1402 here; Aint does not have a move constructor Aint does have a move constructor, which is instantiated from A(A const volatile ) = delete; See 12.8/3: A non-template constructor for class X is a move constructor if its first parameter is of type X, const X, volatile X, or const volatile X, and either there are no other parameters or else all other parameters have default arguments
[Bug c++/51317] [C++0x] [DR 587] Wrong value category of conditional expression where lvalue operands differ only in cv-qualification
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51317 Nikolka tsoae at mail dot ru changed: What|Removed |Added Version|4.7.0 |4.8.0 --- Comment #1 from Nikolka tsoae at mail dot ru 2012-09-10 17:16:46 UTC --- The error still occurs on g++ v.4.7.2 20120908 (prerelease) and v.4.8.0 20120909 (experimental). -4.7.2- Target: i686-pc-linux-gnu Configured with: ../configure --prefix=../target --enable-languages=c,c++ Thread model: posix GNU C++ (GCC) version 4.7.2 20120908 (prerelease) (i686-pc-linux-gnu) compiled by GNU C version 4.7.2 20120908 (prerelease), GMP version 5.0.2, MPFR version 3.1.0, MPC version 0.8.2 COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' test.cpp:3:27: error: lvalue required as unary ‘’ operand -4.8.0- Target: i686-pc-linux-gnu Configured with: ../configure --prefix=../target --enable-languages=c,c++ Thread model: posix GNU C++ (GCC) version 4.8.0 20120909 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 4.8.0 20120909 (experimental), GMP version 5.0.2, MPFR version 3.1.0, MPC version 0.8.2 COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' test.cpp:3:27: error: lvalue required as unary ‘’ operand int const *p = (1 ? x : y); ^
[Bug c++/54541] New: SFINAE bug: handling incomplete return types
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54541 Bug #: 54541 Summary: SFINAE bug: handling incomplete return types Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ts...@mail.ru g++ 4.8.0 20120909 (experimental) fails to compile the following well-defined code: #include utility struct X; X f(int); template class T void g(decltype((void)f(std::declvalT())) *) {} template class T void g(...) {} int main() { gint(0); } COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' test.cpp: In substitution of ‘templateclass T void g(decltype ((void)(f(declvalT(*) [with T = missing]’: test.cpp:16:17: required from here test.cpp:8:50: error: invalid use of incomplete type ‘struct X’ void g(decltype((void)f(std::declvalT())) *) ^ test.cpp:3:12: error: forward declaration of ‘struct X’ struct X; ^ Compiler version info: Target: i686-pc-linux-gnu Configured with: ../configure --prefix=../target --enable-languages=c,c++ Thread model: posix GNU C++ (GCC) version 4.8.0 20120909 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 4.8.0 20120909 (experimental), GMP version 5.0.2, MPFR version 3.1.0, MPC version 0.8.2 Explanation: When considering gint(0), for the former g the error [the expression (void)f(std::declvalT()) uses incomplete type X in a context where complete type is required] occurs in immediate context (and there are no any errors in non-immediate context), so the former g should be just excluded from the set of candidate functions due to substitution failure. The latter g is the only viable candidate, so it should be called.
[Bug c++/54542] New: SFINAE bug: handling new expressions
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54542 Bug #: 54542 Summary: SFINAE bug: handling new expressions Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ts...@mail.ru g++ 4.8.0 20120909 (experimental) fails to compile the following well-defined code: template class T void f(decltype(new T(1, 2)) *) { T(1, 2); } template class T void f(...) {} int main() { fint(0); } COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' test.cpp: In substitution of ‘templateclass T void f(decltype (new T)*) [with T = missing]’: test.cpp:12:17: required from here test.cpp:2:14: error: new initializer expression list treated as compound expression [-fpermissive] void f(decltype(new T(1, 2)) *) ^ test.cpp: In substitution of ‘templateclass T void f(decltype (new T)*) [with T = int]’: test.cpp:12:17: required from here test.cpp:2:14: error: new initializer expression list treated as compound expression [-fpermissive] test.cpp:2:38: error: new initializer expression list treated as compound expression [-fpermissive] void f(decltype(new T(1, 2)) *) ^ ‘ Internal compiler error: Error reporting routines re-entered. Compiler version info: Target: i686-pc-linux-gnu Configured with: ../configure --prefix=../target --enable-languages=c,c++ Thread model: posix GNU C++ (GCC) version 4.8.0 20120909 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 4.8.0 20120909 (experimental), GMP version 5.0.2, MPFR version 3.1.0, MPC version 0.8.2 Explanation: When T is int, the new-expression is ill-formed and the error occurs in immediate context, so the former f should be excluded from the set of candidate functions due to substitution failure.
[Bug c++/54543] New: Expression (condition ? array : throw expr)[index] fails to compile
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54543 Bug #: 54543 Summary: Expression (condition ? array : throw expr)[index] fails to compile Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ts...@mail.ru g++ 4.8.0 20120909 (experimental) fails to compile the following well-defined code: int f(int (arr)[10], int n) { return ((0 = n n 10) ? arr : throw error)[n]; } int main() {} COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' test.cpp: In function ‘int f(int ()[10], int)’: test.cpp:3:46: error: void value not ignored as it ought to be return ((0 = n n 10) ? arr : throw error)[n]; ^ Compiler version info: Target: i686-pc-linux-gnu Configured with: ../configure --prefix=../target --enable-languages=c,c++ Thread model: posix GNU C++ (GCC) version 4.8.0 20120909 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 4.8.0 20120909 (experimental), GMP version 5.0.2, MPFR version 3.1.0, MPC version 0.8.2
[Bug c++/54506] Defaulted move constructors and move assignment operators are erroneously defined as deleted
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54506 --- Comment #3 from Nikolka tsoae at mail dot ru 2012-09-09 20:55:38 UTC --- g++ v4.7.2 20120908 (prerelease) compiles the original example successfully, but it fails to compile the following code: template class T struct A { A() {} A(A const volatile ) = delete; A operator =(A const volatile ) = delete; template class U A(AU ) {} template class U A operator =(AU ) { return *this; } }; struct B { Aint a; B() = default; }; int main() { B b = B(); b = B(); } Target: i686-pc-linux-gnu Configured with: ../configure --prefix=../target --enable-languages=c,c++ Thread model: posix gcc version 4.7.2 20120908 (prerelease) (GCC) COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' ../target/libexec/gcc/i686-pc-linux-gnu/4.7.2/cc1plus -quiet -v -D_GNU_SOURCE test.cpp -quiet -dumpbase test.cpp -mtune=generic -march=pentiumpro -auxbase test -std=c++11 -version -o /tmp/cc0973J0.s GNU C++ (GCC) version 4.7.2 20120908 (prerelease) (i686-pc-linux-gnu) compiled by GNU C version 4.7.2 20120908 (prerelease), GMP version 5.0.2, MPFR version 3.1.0, MPC version 0.8.2 test.cpp: In function ‘int main()’: test.cpp:23:17: error: use of deleted function ‘B::B(const B)’ test.cpp:15:12: note: ‘B::B(const B)’ is implicitly deleted because the default definition would be ill-formed: test.cpp:15:12: error: use of deleted function ‘constexpr Aint::A(const Aint)’ test.cpp:2:16: note: ‘constexpr Aint::A(const Aint)’ is implicitly declared as deleted because ‘Aint’ declares a move constructor or move assignment operator test.cpp:24:15: error: use of deleted function ‘B B::operator=(const B)’ test.cpp:15:12: note: ‘B B::operator=(const B)’ is implicitly deleted because the default definition would be ill-formed: test.cpp:15:12: error: use of deleted function ‘Aint Aint::operator=(const Aint)’ test.cpp:2:16: note: ‘Aint Aint::operator=(const Aint)’ is implicitly declared as deleted because ‘Aint’ declares a move constructor or move assignment operator
[Bug c++/54506] Defaulted move constructors and move assignment operators are erroneously defined as deleted
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54506 --- Comment #5 from Nikolka tsoae at mail dot ru 2012-09-09 22:42:03 UTC --- (In reply to comment #4) These examples aren't similar. An implicitly defined move constructor performs direct-initialization of non-static data members with the corresponding members of the argument, which is interpreted as xvalue (12.8/15). In every such a direct-initialization all constructors are considered (13.3.1.3), including constructor templates. Template argument for the parameter U can be deduced as int, and the produced specialization of the constructor template will have better match than both copy and move constructors. Similarly for assignment operators. struct A cannot be moved because its move operations are deleted This is not so in my example, and g++ correctly handles the following case: template class T struct A { A() {} A(A const volatile ) = delete; A operator =(A const volatile ) = delete; template class U A(AU ) {} template class U A operator =(AU ) { return *this; } }; int main() { Aint a = Aint(); // OK a = Aint(); // OK }
[Bug c++/54506] Defaulted move constructors and move assignment operators are erroneously defined as deleted
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54506 --- Comment #2 from Nikolka tsoae at mail dot ru 2012-09-08 12:17:24 UTC --- (In reply to comment #1) How are you calling g++? /mingw-gcc-4.7.1/bin/g++ test.cpp -std=c++11 What version are you using? Target: i686-pc-mingw32 Configured with: ../src/configure --prefix=/c/temp/gcc/dest --with-gmp=/c/temp/gcc/gmp --with-mpfr=/c/temp/gcc/mpfr --with-mpc=/c/temp/gcc/mpc --enable-languages=c,c++ --with-arch=i686 --with-tune=generic --disable-libstdcxx-pch --disable-nls --disable-shared --disable-sjlj-exceptions --disable-win32-registry --enable-checking=release --enable-lto Thread model: win32 gcc version 4.7.1 (GCC) What is the diagnostic you get? test.cpp: In function 'int main()': test.cpp:25:17: error: use of deleted function 'B::B(B)' test.cpp:19:9: note: 'B::B(B)' is implicitly deleted because the default definition would be ill-formed: test.cpp:19:9: error: non-static data member 'B::a' does not have a move constructor or trivial copy constructor test.cpp:26:15: error: use of deleted function 'B B::operator=(B)' test.cpp:20:12: note: 'B B::operator=(B)' is implicitly deleted because the default definition would be ill-formed: test.cpp:20:12: error: non-static data member 'B::a' does not have a move assignment operator or trivial copy assignment operator
[Bug c++/54521] g++ fails to call explicit constructors in the second step of copy initialization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54521 --- Comment #2 from Nikolka tsoae at mail dot ru 2012-09-08 12:36:29 UTC --- (In reply to comment #1) Works fine with 4.6.3, 4.7.2 20120716 (prerelease) and 4.8.0 20120716 (experimental) As requested when submitting the bug, please provide the information requested at http://gcc.gnu.org/bugs/ including the command line and output of gcc -v 1) Version info: Target: i686-pc-mingw32 Configured with: ../src/configure --prefix=/c/temp/gcc/dest --with-gmp=/c/temp/gcc/gmp --with-mpfr=/c/temp/gcc/mpfr --with-mpc=/c/temp/gcc/mpc --enable-languages=c,c++ --with-arch=i686 --with-tune=generic --disable-libstdcxx-pch --disable-nls --disable-shared --disable-sjlj-exceptions --disable-win32-registry --enable-checking=release --enable-lto Thread model: win32 gcc version 4.7.1 (GCC) COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-mtune=generic' '-march=i686' c:/common/c++/mingw/mingw-gcc-4.7.1/bin/../libexec/gcc/i686-pc-mingw32/4.7.1/cc1plus.exe -quiet -v -iprefix ..\bin\../lib/gcc/i686-pc-mingw32/4.7.1/ test.cpp -quiet -dumpbase test.cpp -mtune=generic -march=i686 -auxbase test -std=c++11 -version -o GNU C++ (GCC) version 4.7.1 (i686-pc-mingw32) compiled by GNU C version 4.7.1, GMP version 5.0.5, MPFR version 3.1.0-p10, MPC version 0.9 Diagnostic message: test.cpp: In function 'int main()': test.cpp:9:15: error: no matching function for call to 'X::X(X)' test.cpp:9:15: note: candidate is: test.cpp:3:9: note: X::X(int) test.cpp:3:9: note: no known conversion for argument 1 from 'X' to 'int' 2) Version info: Target: i686-pc-linux-gnu Configured with: .../configure --prefix=.../target --enable-languages=c,c++ Thread model: posix gcc version 4.8.0 20120826 (experimental) (GCC) Diagnostic message: test.cpp: In function ‘int main()’: test.cpp:9:15: error: no matching function for call to ‘X::X(X)’ X x = 1; // error: no matching function for call to 'X::X(X)' ^ test.cpp:9:15: note: candidate is: test.cpp:3:9: note: X::X(int) X(int) {} ^ test.cpp:3:9: note: no known conversion for argument 1 from ‘X’ to ‘int’
[Bug c++/54526] New: :: is incorrectly treated as digraph : followed by colon
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54526 Bug #: 54526 Summary: :: is incorrectly treated as digraph : followed by colon Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ts...@mail.ru g++ 4.8.0 20120826 (experimental) fails to compile the following well-defined code: template class T struct X {}; struct A {}; int main() { X::A x; // error: ‘::’ cannot begin a template-argument list } According to C++11 - 2.5 p3, bullet 2: If the input stream has been parsed into preprocessing tokens up to a given character: ... if the next three characters are :: and the subsequent character is neither : nor , the is treated as a preprocessor token by itself and not as the first character of the alternative token :. Compiler version info: Target: i686-pc-linux-gnu Configured with: .../configure --prefix=.../target --enable-languages=c,c++ Thread model: posix gcc version 4.8.0 20120826 (experimental) (GCC) Command line: g++ test.cpp -std=c++11 -pedantic-errors Diagnostic message: test.cpp: In function ‘int main()’: test.cpp:8:10: error: ‘::’ cannot begin a template-argument list [-fpermissive] X::A x; ^ test.cpp:8:10: note: ‘:’ is an alternate spelling for ‘[’. Insert whitespace between ‘’ and ‘::’ test.cpp:8:10: note: (if you use ‘-fpermissive’ G++ will accept your code)
[Bug c++/54521] g++ fails to call explicit constructors in the second step of copy initialization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54521 --- Comment #3 from Nikolka tsoae at mail dot ru 2012-09-08 13:25:20 UTC --- In both cases (for g++ v4.7.1 and v4.8.0) the only compiler option was -std=c++11. Nothing magical.
[Bug c++/54521] New: g++ fails to call explicit constructors in the second step of copy initialization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54521 Bug #: 54521 Summary: g++ fails to call explicit constructors in the second step of copy initialization Classification: Unclassified Product: gcc Version: 4.7.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ts...@mail.ru g++ fails to compile the following code struct X { X(int) {} explicit X(X const ) {} }; int main() { X x = 1; // error: no matching function for call to 'X::X(X)' } The second step of a copy initialization (see 8.5/16/6/2) is a direct-initialization where explicit constructors shall be considered as candidate functions.
[Bug c++/54506] New: Defaulted move constructors and move assignment operators are erroneously defined as deleted
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54506 Bug #: 54506 Summary: Defaulted move constructors and move assignment operators are erroneously defined as deleted Classification: Unclassified Product: gcc Version: 4.7.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ts...@mail.ru g++ rejects the following well-formed code: template class T struct A { A() {} A(A const volatile ) = delete; A operator =(A const volatile ) = delete; template class U A(AU ) {} template class U A operator =(AU ) { return *this; } }; struct B { Aint a; B() = default; B(B ) = default; B operator =(B ) = default; }; int main() { B b = B(); b = B(); } The compiler says that the defaulted move functions in B are deleted, however 12.8/11 and 12.8/23 do not define such functions as deleted.
[Bug c++/52625] Incorrect specialization semantics of friend class template declaration
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52625 Nikolka tsoae at mail dot ru changed: What|Removed |Added CC||tsoae at mail dot ru --- Comment #1 from Nikolka tsoae at mail dot ru 2012-03-20 07:34:03 UTC --- G++ issues the same diagnostic message for the following example: templateclass class base {}; class derived : public basederived { // error: specialization of 'basederived' after instantiation templateclass friend class basederived; }; It seems that in the original example g++ incorrectly treats the injected-class-name ::basederived::base as template specialization basederived, while according to 14.6.1/1 it shall be refer to class template base. Note that g++ does not issue an error in the following case: templateclass class base {}; class derived : public basederived { templateclass friend class ::base; }; int main() {}
[Bug c++/51316] alignof doesn't work with arrays of unknown bound
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51316 --- Comment #5 from Nikolka tsoae at mail dot ru 2011-12-28 22:06:18 UTC --- On it. There is an active core issue about alignof: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3309.html#1305 Probably, you should take into account the proposed resolution.
[Bug c++/51316] alignof doesn't work with arrays of unknown bound
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51316 --- Comment #2 from Nikolka tsoae at mail dot ru 2011-11-27 08:37:37 UTC --- Note that this usage is not valid in C1X. Could you explain?
[Bug c++/51312] New: Wrong interpretation of converted constant expressions (for template arguments and enumerator initializers)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51312 Bug #: 51312 Summary: Wrong interpretation of converted constant expressions (for template arguments and enumerator initializers) Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ts...@mail.ru GNU C++ 4.7.0 fails to compile the following well-defined code: struct X { constexpr operator int() { return true; } }; template int struct A {}; int main() { // error: expected a constant of type 'int', got 'X()' AX()(); // error: enumerator value for 'e' is not an integer constant enum : int { e = X() }; } In both cases a converted constant expression of type int is required (see 14.3.2/1/1 and 7.2/5). According to 5.19/3, X() can be used in a context where a converted constant expression of type int is required.
[Bug c++/51312] Wrong interpretation of converted constant expressions (for template arguments and enumerator initializers)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51312 --- Comment #2 from Nikolka tsoae at mail dot ru 2011-11-26 15:33:36 UTC --- For the first one, you should write X{} instead of X() which looks too much like a function type. I agree, that was my mistake.
[Bug c++/51316] New: alignof doesn't work with arrays of unknown bound
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51316 Bug #: 51316 Summary: alignof doesn't work with arrays of unknown bound Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ts...@mail.ru gcc 4.7.0 rejects the following code: int main() { // error: invalid application of '__alignof__' to incomplete type 'int []' alignof(int []); } 5.3.6/1: An alignof expression yields the alignment requirement of its operand type. The operand shall be a type-id representing a complete object type or an array thereof or a reference to a complete object type. int[] is array of complete object type.
[Bug c++/51317] New: Wrong value category of conditional expression where lvalue operands differ only in cv-qualification (see DR 587)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51317 Bug #: 51317 Summary: Wrong value category of conditional expression where lvalue operands differ only in cv-qualification (see DR 587) Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ts...@mail.ru GCC 4.7.0 rejects the following application of address-of operator: int x = 1; int const y = 2; int const *p = (1 ? x : y); // error: lvalue required as unary '' operand Such behavior was correct in C++03, but it is incorrect in C++11 - see http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#587