home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 33,108 of 33,346   
   =?windows-1252?Q?Daniel_Kr=FCgler?= to marcel.loose@googlemail.com   
   Re: Invalid C++ or bug in GCC 4.8   
   27 Jun 13 05:27:59   
   
   From: daniel.kruegler@googlemail.com   
      
   On 2013-06-27 02:46, marcel.loose@googlemail.com wrote:   
   > I was quite unhappy to find out that code I've written years ago   
   > suddenly fails to compile with the latest GCC (4.8). It compiles   
   > without warning (with -Wall and -Wextra) with GCC 4.7.3 as well as   
   > with Clang 3.2.   
   >   
   > Below is a completely stripped down version of the code. Is this   
   > illegal C++ code, or is this a bug in GCC 4.8?   
      
   The code looks invalid to me, see below why.   
      
   >    
   > template  class ObjectFactory;   
   >   
   > template   
   > class ObjectFactory { };   
   >   
   > struct Abstract { virtual ~Abstract() = 0; };   
   >   
   > struct Concrete : Abstract { };   
   >   
   > typedef ObjectFactory< Abstract(), int> MyFactory;   
   >    
   >   
   > When compiling with GCC 4.8 I get the following error:   
   >   
   > Eabstract-class-type.cc:10:33: error: ‘type name’ declared as   
   > function returning an abstract class type   
   >   typedef ObjectFactory< Abstract(), int> MyFactory;   
      
   The error looks appropriate to me. According to 10.4 [class.abstract],   
   p3:   
      
   "An abstract class shall not be used as a parameter type, as a   
   function return type, [..]"   
      
   This is clearly violated here.   
      
   HTH & Greetings from Bremen,   
      
   Daniel Krügler   
      
      
      
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca