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 32,161 of 33,346   
   Marc to All   
   ref-qualifier on "this" and mangling   
   20 Apr 12 01:58:45   
   
   From: marc.glisse@gmail.com   
      
   Hello,   
      
   while the question appears to be about a specific ABI, it is really   
   about the validity of code that would expose issues in it.   
      
   Starting from a member function type and applying the following trait,   
   one can get a function type:   
      
   template struct RP;   
   template struct RP{typedef T type;};   
      
   If the member function has a cv-qualifier (that applies to *this), it   
   gives a strange type like int(double)const. In name mangling terms,   
   this can be encoded by taking the type int(double) and making it   
   const, and since a function cannot be const it is unambiguous.   
      
   Now in C++11, we can also have ref-qualifiers on *this, so it seems   
   natural to proceed in the same way. Except that this time,   
   int(&)(double) is a valid type, completely unrelated to int(double)&.   
   Clang mangles them the same (and so will probably all other users of   
   the Itanium C++ ABI), which seems to me to be an issue, but it is   
   quite possible that the contorsions necessary to make the type   
   int(double)& appear are illegal, although DR 1417 seems to confirm   
   what I say.   
      
   Any opinion?   
      
      
   --   
         [ 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