On Fri, Jun 15, 2012 at 11:19 AM, Jordan Rose <[email protected]> wrote: > Author: jrose > Date: Fri Jun 15 13:19:48 2012 > New Revision: 158531 > > URL: http://llvm.org/viewvc/llvm-project?rev=158531&view=rev > Log: > Warn when a static variable is referenced in a non-static inline function. > > This is explicitly forbidden in C99 6.7.4p3. This is /not/ forbidden in C++, > probably because by default file-scope const/constexpr variables have internal > linkage, while functions have external linkage. There's also the issue of > anonymous namespaces to consider. Nevertheless, there should probably be a > similar warning, since the semantics of inlining a function that references > a variable with internal linkage do not seem well-defined.
The equivalent language in C++ is [basic.def.odr]p5. It's a bit tricky to diagnose, though. -Eli _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
