[Bug c++/63179] Virtuality is not working
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63179 --- Comment #2 from Pavel isak50 at mail dot ru --- Sorry.
[Bug c++/63179] New: Does not work virtuality
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63179 Bug ID: 63179 Summary: Does not work virtuality Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: isak50 at mail dot ru // g++ 1.cpp -O2 -Wall -std=c++11 -Wall #include stdio.h struct Base{ virtual void f() {printf(base\n);} }; struct Child : Base{ void f()override {printf(child\n);} }; alignas(Child) char buf[sizeof(Child)]; union Ptr{ decltype(::buf) buf; Base base; }; int main(){ new(buf) Child; Ptr *ptr = reinterpret_castPtr*(buf); //---printf: base---// ptr-base.f(); // Base b = ptr-base;// b.f(); // clang print child. //--// //---printf: child--// Base *b2 = ptr-base; // b2-f();// //--// }
[Bug other/61549] New: Error when linking with shared libraries
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61549 Bug ID: 61549 Summary: Error when linking with shared libraries Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: isak50 at mail dot ru // os - linux debian //-- /usr/local/lib/1.cpp #include iostream struct S { int val; S() {val=1; std::cout 1::constr\n;} ~S() {std::cout 1::destr\n;} }s; extern int f1() {return s.val;} //-- /usr/local/lib/2.cpp #include iostream struct S { int val; S() {val=2; std::cout 2::constr\n;} ~S() {std::cout 2::destr\n;} }s; extern int f2() {return s.val;} //-- /usr/local/lib/ex.cpp #include iostream extern int f1(); extern int f2(); int main() { std::cout ex::main\n; std::cout f1 = f1() \n; std::cout f2 = f2() \n; return 0; } //-- buid /usr/local/lib $ g++ 1.cpp -fPIC -shared -o lib1.so /usr/local/lib $ g++ 2.cpp -fPIC -shared -o lib2.so /usr/local/lib $ g++ ex.cpp lib1.so lib2.so -o ex /usr/local/lib $ ldconfig //-- run ./ex //-- output 1::constr 1::constr // Why 1::constr? should be 2::constr ex::main f1 = 1 f2 = 1 1::destr// Why 1::destr? should be 2::destr 1::destr
[Bug c++/61327] Problem with friend template object
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61327 --- Comment #2 from Pavel isak50 at mail dot ru --- // Clang compiles without errors. class B { protected: void f() {} }; template typename... struct S; template typename R struct SR{ template typename T static void caller(T *p) {p-B::f();} // error: 'void B::f()' is protected //static void caller(T *p) {p-f();}// Ok }; class Q : B{ template typename... friend struct S; }; int main(){ Q q; Sint::caller(q); return 0; }
[Bug c++/61327] New: Problem with friend template object
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61327 Bug ID: 61327 Summary: Problem with friend template object Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: isak50 at mail dot ru // Although struct Call_check is a friend for the Comp, the compiler reports // that Cnd1::ch() is protected. #include iostream #include type_traits template typename... _Break_expression struct Call_check; template typename _Type struct Call_check_Type { template typename _T static void call(_T *trend) { trend-_Type::ch(); } }; class Cnd1 { protected: void ch(void) {std::cout hello from Cnd1\n;} }; class Comp : Cnd1 { template typename... friend struct Call_check; public: void check() {Call_checkCnd1::call(this);} }; int main() { Comp cm; cm.check(); return 0; }
[Bug c++/59554] New: Errors with const and volatile in templates.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59554 Bug ID: 59554 Summary: Errors with const and volatile in templates. Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: isak50 at mail dot ru Created attachment 31477 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=31477action=edit source.ii // templates mis_... don't find out a const and a volatile. Also std tools of // type_traits fail. // Windows, TDM GCC #include stdio.h template typename _Ty struct mis_const{ static void ch() { printf(is const: false\n); } }; template typename _Ty struct mis_constconst _Ty { static void ch() { printf(is const: true\n); } }; template typename _Ty struct mis_volatile { static void ch() { printf(is volatile: false\n); } }; template typename _Ty struct mis_volatilevolatile _Ty { static void ch() { printf(is volatile: true\n); } }; template typename _Ty struct mis_pointer { static void ch() { printf(is pointer: false\n); } }; template typename _Ty struct mis_pointer_Ty * { static void ch() { printf(is pointer: true\n); } }; template typename _T void show(_T t) { printf(--_T\n); mis_const_T::ch(); mis_volatile_T::ch(); mis_pointer_T::ch(); printf(--decltype(t)---\n); mis_constdecltype(t)::ch(); mis_volatiledecltype(t)::ch(); mis_pointerdecltype(t)::ch(); } int main() { const volatile int *g {nullptr}; show(g); return 0; } // Console output: // --_T // is const:false error: not const. // is volatile: false error: not volatile. // is pointer: true It's ok? // --decltype(t)--- // is const:false // is volatile: false // is pointer: true
[Bug c++/59554] Errors with const and volatile in templates.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59554 --- Comment #2 from Pavel isak50 at mail dot ru --- if i edit code so: template typename _T void show(_T t) { *t = nullptr;// added printf(--_T\n); mis_const_T::ch(); mis_volatile_T::ch(); mis_pointer_T::ch(); printf(--decltype(t)---\n); mis_constdecltype(t)::ch(); mis_volatiledecltype(t)::ch(); mis_pointerdecltype(t)::ch(); } i receive error: C:\TDM\msys\1.0\prg\tmake -s ../source.cpp: In instantiation of 'void show(_T) [with _T = const volatile int* ]': ../source.cpp:43:11: required from here ../source.cpp:26:12: error: assignment of read-only location '* t' *t = nullptr; Pay attention: [with _T = const volatile int*]
[Bug c++/59554] Errors with const and volatile in templates.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59554 --- Comment #3 from Pavel isak50 at mail dot ru --- Sorry, I am wrong. Gcc work right.