[PATCH] [-cxx-abi microsoft] Mangle TemplateArgument::Declaration correctly for member pointers
David Majnemer
david.majnemer at gmail.com
Thu Aug 29 19:40:05 PDT 2013
================
Comment at: lib/AST/MicrosoftMangle.cpp:891
@@ +890,3 @@
+ getASTContext().getCharWidth();
+ mangleIntegerLiteral(Offset, false);
+ } else
----------------
Reid Kleckner wrote:
> There's a fair amount of complexity in member pointers.
> - Can I mangle in a null data memptr here?
> - The null representation is different between standard layout records (-1) and other records (0).
> - Can I mangle a field from a base class that is not at offset 0?
>
> All this is currently handled in CodeGen/MicrosoftCXXABI.cpp, which this AST code can't depend on. We could raise some parts of it up into the AST CXXABI if needed.
- Yes.
- null data memptr get's mangled like -1 for standard layout records and 0 for other records.
- Yes:
```
struct base1 {
int thing;
virtual int fun();
};
struct base2 : virtual public base1 {
int thing;
virtual int fun2();
};
struct record : public base2, virtual public base1 {
int first;
int second;
virtual int fun3();
};
template <int record::*>
struct type2 {};
type2<(int record::*)(&base2::thing)> memptr4;
type2<(int record::*)(&base1::thing)> memptr5;
```
get's mangled like so:
```
struct type2<{8,0}> memptr4
struct type2<{4,4}> memptr5
```
Note that clang **refuses** to do anything with this C++ code.
http://llvm-reviews.chandlerc.com/D1323
More information about the cfe-commits
mailing list