diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-04 09:53:13 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-04 09:53:13 +0000 |
commit | f4c51d9d7613004222c3cc1a6944249a508a6399 (patch) | |
tree | 4ff413a8be66c8b4970f5be0eaef6fa10911d357 /clang/test/SemaCXX/enum-bitfield.cpp | |
parent | 5b26f27f465676684f9440f02ac4e84a252f5bbb (diff) | |
download | bcm5719-llvm-f4c51d9d7613004222c3cc1a6944249a508a6399.tar.gz bcm5719-llvm-f4c51d9d7613004222c3cc1a6944249a508a6399.zip |
In C++11 mode, when an integral constant expression is desired and we have a
value of class type, look for a unique conversion operator converting to
integral or unscoped enumeration type and use that. Implements [expr.const]p5.
Sema::VerifyIntegerConstantExpression now performs the conversion and returns
the converted result. Some important callers of Expr::isIntegralConstantExpr
have been switched over to using it (including all of those required for C++11
conformance); this switch brings a side-benefit of improved diagnostics and, in
several cases, simpler code. However, some language extensions and attributes
have not been moved across and will not perform implicit conversions on
constant expressions of literal class type where an ICE is required.
In passing, fix static_assert to perform a contextual conversion to bool on its
argument.
llvm-svn: 149776
Diffstat (limited to 'clang/test/SemaCXX/enum-bitfield.cpp')
-rw-r--r-- | clang/test/SemaCXX/enum-bitfield.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/enum-bitfield.cpp b/clang/test/SemaCXX/enum-bitfield.cpp index 831b9825111..63445ca0583 100644 --- a/clang/test/SemaCXX/enum-bitfield.cpp +++ b/clang/test/SemaCXX/enum-bitfield.cpp @@ -14,5 +14,5 @@ struct X { struct Y { enum E : int(2); - enum E : Z(); // expected-error{{not an integral constant}} + enum E : Z(); // expected-error{{integral constant expression must have integral or unscoped enumeration type, not 'Z'}} }; |