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,313 of 33,346   
   =?UTF-8?B?Sm9zaHVhIENyYW5tZXIg8J+Qp to marcel.loose@googlemail.com   
   Re: Is this use of the keyword struct in   
   18 Apr 14 08:50:43   
   
   From: Pidgeot18@verizon.invalid   
      
   On 4/17/2014 7:26 AM, marcel.loose@googlemail.com wrote:   
   > When I remove struct in the declaration of doIt(), everything compiles fine.   
   > What's going on here?   
      
   Clang compiles this without issue; after reading the C++11   
   specification, I suspect that gcc is erring in presenting a compiler   
   warning:   
      
   The lookup rules for a struct-qualified expression differ slightly from   
   normal unqualified lookup in that "non-type names" are ignored. The   
   specification doesn't explicitly state if a using declaration of a type   
   name is itself a type name (the wording uses "a synonym for the name   
   [...] declared elsewhere"). Even so, it's hard to argue that result of a   
   using declaration for a type name isn't a type name itself, so I'd say   
   that the lookup should catch that S is supposed to refer to A::S.   
      
   For some reason, gcc disagrees with my logic, so instead the   
   (anti-)feature of elaborated type specifiers kicks in and a new struct S   
   is declared in the class scope, making the 'struct S' that didn't match   
   anything into an implicit declaration for a struct B::S.   
      
   --   
   Beware of bugs in the above code; I have only proved it correct, not   
   tried it. -- Donald E. Knuth   
      
      
         [ 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