svn snapshot from r125847
Created attachment 13735 [details] preprocessed source
Created attachment 13737 [details] source file that causes ICE reduced. just three line for ICE
Comment on attachment 13737 [details] source file that causes ICE removing static keyword at the top resolves problem. but is it workaround?
Related to PR 32596.
Actually, two lines suffice: template<unsigned x> static inline void f() { } template<> inline void f<5>() { } This also breaks inkscape.
(In reply to comment #5) > Actually, two lines suffice: I don't remember if template functions can be static. I really think they cannot. Which is one of the reasons why this bug was not marked as confirmed or have a keyword assigned to it. Note PR 32596 is definitely valid code, anonymous namespaces templates.
I believe this to be valid code.
The patch for PR32596 fixes this as well.
Subject: Bug 32400 Author: jakub Date: Tue Aug 28 16:08:02 2007 New Revision: 127863 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127863 Log: PR c++/32596 PR c++/32400 * pt.c (check_explicit_specialization): Set DECL_INTERFACE_KNOWN and DECL_NOT_REALLY_EXTERN if tmpl_func is not public. * g++.dg/ext/visibility/anon5.C: New test. Added: trunk/gcc/testsuite/g++.dg/ext/visibility/anon5.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog
Fixed.
Here is what the C++ standard says about linkage: A template name may have linkage (3.5). A template, a template explicit specialization (14.7.3), or a class template partial specialization shall not have C linkage. If the linkage of one of these is something other than C or C++, the behavior is implementation defined. Template definitions shall obey the one definition rule (3.2). So this is implementation defined as far as I can tell, and I think this is really a bad choice to accept this code.
(In reply to comment #11) > Here is what the C++ standard says about linkage: > A template name may have linkage (3.5). A template, a template explicit > specialization (14.7.3), or a class > template partial specialization shall not have C linkage. If the linkage of one > of these is something other > than C or C++, the behavior is implementation defined. > Template definitions shall obey the one definition > rule (3.2). > > > So this is implementation defined as far as I can tell, and I think this is > really a bad choice to accept this code. Uh, can you justify your opinion? Neither can I see why this would be bad style nor can I see why you would think that anything in the code in comment #5 would be implementation defined (nothing here has linkage other than C or C++ that would have been listed in the paragraph you cite). W.