[cfe-dev] better way to test for explicit C++ constructor?
Peeter Joot
peeter.joot at gmail.com
Wed Dec 12 05:28:27 PST 2012
But why not instead just directly look at the initializer for
> theBigGiantGlobalVariable, which will be a CXXConstructExpr pointing
> directly to the default constructor? You can then walk over the
> initializers in that constructor — which, since it's an implicitly-defined
> default constructor, should all be non-trivial — and see what constructors
> they use, etc.
>
>
sounds reasonable. Why not is because I didn't know enough to do this the
smart way.
> Anyway, this would also be a reasonable enhancement request for
> -Wglobal-constructors; we could easily say:
> warning: declaration requires a global constructor
> ...
> note: because type 'a' has a non-trivial default constructor
> note: because type 'b' has a non-trivial default constructor
> note: because type 'nowHasConstructor' has a non-trivial default
> constructor
>
>
That sounds excellent. Is -Wglobal-constructors documented? I don't see
it in the User manual?
--
Peeter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121212/f47da6f3/attachment.html>
More information about the cfe-dev
mailing list