[Bug c++/13474] fail to compile non type argument specialization of pointer to array of int

giovannibajo at libero dot it gcc-bugzilla@gcc.gnu.org
Sun Jan 11 01:21:00 GMT 2004


------- Additional Comments From giovannibajo at libero dot it  2004-01-11 01:21 -------
>From my reading of the standard, int (*)[Y] is a deducible context, and it's 
type-dependent on the previous template parameter. "&array" matches it 
perfectly, and the specialization should indeed be chosen. The full testcase 
(which also tests if the specialization is being selected) is the following:

-----------------------------------------------
template< int X, int Y, int (*array_ptr)[Y] > 
class A;

int array[5];
template< int X > class A<X,5,&array> {};

template class A<6,5,&array>;    
-----------------------------------------------

This is valid C++ to me and should be accepted. It's rejected by any GCC 
version on earth (ok, on my hard disk). It crashes EDG as Andrew pointed out, 
and it's accepted by MSVC71.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2004-01-11 01:21:13
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13474



More information about the Gcc-bugs mailing list