Bug 41341

Summary: gcc fails to reject inclass partial specialization of inherited class template
Product: gcc Reporter: Tomasz Kêpczyñski <tomek>
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED WORKSFORME    
Severity: normal CC: gcc-bugs
Priority: P3    
Version: 4.3.2   
Target Milestone: 4.5.0   
Host: Target:
Build: Known to work: 4.5.0
Known to fail: Last reconfirmed:
Attachments: the offending code

Description Tomasz Kêpczyñski 2009-09-11 21:39:12 UTC
In the attached code partial specialization of struct apply in struct METAFUNCTION2 should be rejected according to C++ Standard 14.7.3/3:

A declaration of a function template or class template being explicitly specialized shall be in scope at the point of declaration of an explicit specialization.

What's more troublesome is a fact that specialization in METAFUNCTION2 seems to affect the template in METAFUNCTION. The program produces:

int
double
double

while I would expect:

int
HELPER<float, double>
double
Comment 1 Tomasz Kêpczyñski 2009-09-11 21:40:03 UTC
Created attachment 18568 [details]
the offending code
Comment 2 Paolo Carlini 2009-12-27 01:54:55 UTC
Fixed for 4.5.0, not a regression, closing as fixed.