[Bug c++/17232] classes and class template specializations treated differently w.r.t. core issue #337

giovannibajo at libero dot it gcc-bugzilla@gcc.gnu.org
Mon Aug 30 12:30:00 GMT 2004


------- Additional Comments From giovannibajo at libero dot it  2004-08-30 12:30 -------
Confirmed.

The problem is that A<int> was not instantiated at the point of call. So the 
compiler does not know yet if A<int> is an abstract type or not -- it will have 
to instantiate that to do so. Now, I am not sure we should force an 
instantiation just because we are trying to form an array type and we need to 
check for abstractness, I fear this requires a clarification from C++ gurus.

The simple workaround is to force an instantiation of the class to happen 
before the call. I don't know if it is possible in your application, though. 
For the testcase, you need to add a "template struct A<int>;" somewhere before 
the call.

What EDG does is to simply ignore the abstract constraint in this situation, 
and allow the call. It will then error out when the array is first used in the 
body of the function as the underlying type is abstract -- but it seems to me 
as a violation of [dcl.array]/1 which says that it is invalid to (just) declare 
an array to abstract type.

I think you are better off raising this issue with comp.std.c++, and get back 
to us. If there is agreement that EDG is wrong and the template deduction 
should be rejected through an instantiation of the argument, I can implement 
this solution into the compiler (I implemented DR 337 in the first place).

I also would like to know if this affects your application in a way that causes 
a regression (that is, 3.3 works but 3.4 does not), because your testcase is 
wisely constructed as a regression, but the actual bug is not (since DR 337 was 
first implemented in 3.4, and has this "bug" since then).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |giovannibajo at libero dot
                   |                            |it
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |accepts-invalid, rejects-
                   |                            |valid, wrong-code
      Known to fail|                            |2.95.3 3.0.4 3.2.3 3.3.3
                   |                            |3.4.0 3.5.0
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-30 12:30:24
               date|                            |


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



More information about the Gcc-bugs mailing list