Bug 32400 - [4.3 Regression] ICE in expand_or_defer_fn, at cp/semantics.c:3220
Summary: [4.3 Regression] ICE in expand_or_defer_fn, at cp/semantics.c:3220
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P1 minor
Target Milestone: 4.3.0
Assignee: Jakub Jelinek
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords:
Depends on: 32596
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-19 12:10 UTC by gee
Modified: 2007-09-25 04:22 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-08-21 15:29:13


Attachments
preprocessed source (7.52 KB, text/plain)
2007-06-19 12:10 UTC, gee
Details
source file that causes ICE (108 bytes, text/plain)
2007-06-19 18:13 UTC, gee
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gee 2007-06-19 12:10:01 UTC
svn snapshot from r125847
Comment 1 gee 2007-06-19 12:10:53 UTC
Created attachment 13735 [details]
preprocessed source
Comment 2 gee 2007-06-19 18:13:25 UTC
Created attachment 13737 [details]
source file that causes ICE

reduced. just three line for ICE
Comment 3 gee 2007-06-19 18:18:27 UTC
Comment on attachment 13737 [details]
source file that causes ICE

removing static keyword at the top resolves problem.
but is it workaround?
Comment 4 Andrew Pinski 2007-07-08 11:29:12 UTC
Related to PR 32596.
Comment 5 Falk Hueffner 2007-08-01 20:15:02 UTC
Actually, two lines suffice:

template<unsigned x> static inline void f() { }
template<>		    inline void f<5>() { }

This also breaks inkscape.
Comment 6 Andrew Pinski 2007-08-01 21:29:19 UTC
(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.
Comment 7 Mark Mitchell 2007-08-10 00:30:01 UTC
I believe this to be valid code.
Comment 8 Jakub Jelinek 2007-08-21 15:29:13 UTC
The patch for PR32596 fixes this as well.
Comment 9 Jakub Jelinek 2007-08-28 16:08:32 UTC
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

Comment 10 Jakub Jelinek 2007-08-28 16:09:31 UTC
Fixed.
Comment 11 Andrew Pinski 2007-09-25 00:09:25 UTC
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.
Comment 12 Wolfgang Bangerth 2007-09-25 04:22:28 UTC
(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.