[Bug c++/71784] New: crash on on ref-qual's and templates
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71784 Bug ID: 71784 Summary: crash on on ref-qual's and templates Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mct_ancs at yahoo dot com Target Milestone: --- Created attachment 38844 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38844&action=edit *.cc on ref-qual's and templates see file
[Bug c++/71784] crash on on ref-qual's and templates
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71784 --- Comment #2 from Ela --- Created attachment 38848 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38848&action=edit *.cc file producing the crash
[Bug c++/71784] crash on on ref-qual's and templates
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71784 --- Comment #3 from Ela --- Created attachment 38849 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38849&action=edit the compiler complaint
[Bug c++/71784] crash on on ref-qual's and templates
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71784 --- Comment #4 from Ela --- Created attachment 38850 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38850&action=edit code dump
[Bug c++/71784] crash on on ref-qual's and templates
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71784 --- Comment #5 from Ela --- gcc = gcc (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)
[Bug c++/71784] crash on on ref-qual's and templates
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71784 --- Comment #6 from Ela --- - ... it doesn't matter (or it does ?) if op's are first instantiated via template, or everything is in one file and instantiated "per-need" when they appear (used). (tested various versions and cannot remember now) - in any case: it should work in the separate-compilation model, with files split in *.hh, *.cc, *.ie
[Bug c++/71784] [6/7 Regression] ICE on invalid code in push_access_scope, at cp/pt.c:229
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71784 --- Comment #8 from Ela --- (In reply to Martin Liška from comment #7) > Same as the origin, it's obviously an invalid code. Tested on all Clang-3.8 C++11,14,17 - it works. gcc-6.1.0 is a bit more explicit in some sense: - class instantiation w/ external leaves all members non-inst. - the missing function in the call (in main() ) is written as some mangle, and not in_clear (as it would be with other functions - that one can add for test) - thus seems as a lack of internal repres. or something. Else please enlighten me on the correct syntax.
[Bug c++/71784] [6/7 Regression] ICE on invalid code in push_access_scope, at cp/pt.c:229
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71784 --- Comment #9 from Ela --- (In reply to Ela from comment #8) > (In reply to Martin Liška from comment #7) > > > Same as the origin, it's obviously an invalid code. > > Tested on all Clang-3.8 C++11,14,17 - it works. > > gcc-6.1.0 is a bit more explicit in some sense: >- class instantiation w/ external leaves all > members non-inst. >- the missing function in the call (in main() ) > is written as some mangle, and not in_clear > (as it would be with other functions - that > one can add for test) >- thus seems as a lack of internal repres. or > something. > > Else please enlighten me on the correct syntax. ... actually I made it simpler, in order to get to the root of it: -- #include using std::cout; template class A{ public: template void f(U const&) & ; template void f(U const&) && ; }; template template void A::f(U const& x) & { std::cout << "lvalue object\n" ; } template template void A::f(U const& x) && { std::cout << "rvalue object\n" ; } template class A ; template void A::f(int const&) & ; template void A::f(int const&) &&; int main(){ A a; a.f(2); A().f(1); }
[Bug c++/71784] [6/7 Regression] ICE on invalid code in push_access_scope, at cp/pt.c:229
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71784 --- Comment #10 from Ela --- > ... actually I made it simpler, in order to get to > the root of it: > > --- CORRECTION - #include using std::cout; #include template class A{ public: void f() & ; void f() && ; void g() ; void g(int) ; }; > --- #include "e.hh" template void A::f() & { std::cout << "lvalue object\n" ; } template void A::f() && { std::cout << "rvalue object\n" ; } template void A::g() { std::cout << "lvalue object\n" ; } template void A::g(int x) { std::cout << "rvalue object\n" ; } extern template class A ; //extern template class A ; //template void A::f(float const&) & ; //template void A::f() && ; template void A::f() &; //template void A::f() && ; template void A::g() ; template void A::g(int) ; > --- #include #include "e.hh" using std::cout; int main(){ A a; a.f(); // lvalue // A().f(); // rvalue a.g(); // lvalue a.g(3); // lvalue } > ---
[Bug c++/71784] [4.9/5/6/7 Regression] ICE on invalid code in push_access_scope, at cp/pt.c:229
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71784 --- Comment #12 from Ela --- Example: When an usual member function is missing (say template class instantiated with extern), the compiler (4.9.3, 6.1) will complain in_clear about the missing function. When a ref-qual'ed one is missing it will show some mangle _Z-etc-etc as missing. If it's just the class templated, then letting the class instantiate its own functions => will work. If the function is nested templated, then it has to be explicitly instantiated and again ICE.