Commit Graph

7 Commits

Author SHA1 Message Date
DeLesley Hutchins 5b330db270 Bugfix: bogus warning -- "invalid use of non-static data member",
when a class is forward declared, and the reference to the data
member in question does not occur within a method body.

llvm-svn: 151413
2012-02-25 00:11:55 +00:00
Richard Smith e434590bd9 Change the diagnostics which said 'accepted as an extension' to instead say
'is an extension'. The former is inappropriate and confusing when building with
-Werror/-pedantic-errors.

llvm-svn: 147357
2011-12-29 21:57:33 +00:00
Richard Smith d0b4dd656d constexpr handling improvements. Produce detailed diagnostics when a 'constexpr'
variable is initialized by a non-constant expression, and pass in the variable
being declared so that earlier-initialized fields' values can be used.

Rearrange VarDecl init evaluation to make this possible, and in so doing fix a
long-standing issue in our C++ constant expression handling, where we would
mishandle cases like:

  extern const int a;
  const int n = a;
  const int a = 5;
  int arr[n];

Here, n is not initialized by a constant expression, so can't be used in an ICE,
even though the initialization expression would be an ICE if it appeared later
in the TU. This requires computing whether the initializer is an ICE eagerly,
and saving that information in PCH files.

llvm-svn: 146856
2011-12-19 06:19:21 +00:00
Richard Smith 9ca5c42582 Update all tests other than Driver/std.cpp to use -std=c++11 rather than
-std=c++0x. Patch by Ahmed Charles!

llvm-svn: 141900
2011-10-13 22:29:44 +00:00
Richard Smith 7b729cdbff Suggest adding 'constexpr' if the GNU extension for in-class initializers for static const float members is used in C++11 mode.
llvm-svn: 140828
2011-09-30 00:33:19 +00:00
Richard Smith 256336d9ab Mark the ExtWarn for in-class initialization of static const float members as a GNU extension. Don't extend the scope of this extension to all literal types in C++0x mode.
llvm-svn: 140820
2011-09-29 23:18:34 +00:00
Richard Smith ee6311df69 In C++0x, static const volatile data members cannot be initialized in-class.
llvm-svn: 140809
2011-09-29 21:28:14 +00:00