[cfe-dev] Nested functions in Clang?

Nikola Smiljanic via cfe-dev cfe-dev at lists.llvm.org
Sat Sep 12 17:26:34 PDT 2015

>From http://clang.llvm.org/docs/UsersManual.html

clang does not support nested functions; this is a complex feature which is
infrequently used, so it is unlikely to be implemented anytime soon. In
C++11 it can be emulated by assigning lambda functions to local variables,

auto const local_function = [&](int parameter) {
  // Do something

On Sun, Sep 13, 2015 at 10:18 AM, Rodney M. Bates via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> Does Clang have an option that allows C nested functions, as in gcc?
> So far, I can't find it.  I just want to look at generated llvm IR, for
> ideas on the best way to produce it from another front end.
> --
> Rodney Bates
> rodney.m.bates at acm.org
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150913/f0b085ca/attachment.html>

More information about the cfe-dev mailing list