summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/constexpr-value-init.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-02-13 03:54:03 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-02-13 03:54:03 +0000
commit3607ffee5ccaab26be4e99f9beabb4a6c84f2700 (patch)
tree7ebec671a00bf2a92cee0b1b80f1ec6302ef416b /clang/test/SemaCXX/constexpr-value-init.cpp
parent779579b332f55e2a5852c65b4085e4705af9f42c (diff)
downloadbcm5719-llvm-3607ffee5ccaab26be4e99f9beabb4a6c84f2700.tar.gz
bcm5719-llvm-3607ffee5ccaab26be4e99f9beabb4a6c84f2700.zip
Update constexpr implementation to match CWG's chosen approach for core issues
1358, 1360, 1452 and 1453. - Instantiations of constexpr functions are always constexpr. This removes the need for separate declaration/definition checking, which is now gone. - This makes it possible for a constexpr function to be virtual, if they are only dependently virtual. Virtual calls to such functions are not constant expressions. - Likewise, it's now possible for a literal type to have virtual base classes. A constexpr constructor for such a type cannot actually produce a constant expression, though, so add a special-case diagnostic for a constructor call to such a type rather than trying to evaluate it. - Classes with trivial default constructors (for which value initialization can produce a fully-initialized value) are considered literal types. - Classes with volatile members are not literal types. - constexpr constructors can be members of non-literal types. We do not yet use static initialization for global objects constructed in this way. llvm-svn: 150359
Diffstat (limited to 'clang/test/SemaCXX/constexpr-value-init.cpp')
-rw-r--r--clang/test/SemaCXX/constexpr-value-init.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/constexpr-value-init.cpp b/clang/test/SemaCXX/constexpr-value-init.cpp
index efa9e94da12..db4b68dcc6d 100644
--- a/clang/test/SemaCXX/constexpr-value-init.cpp
+++ b/clang/test/SemaCXX/constexpr-value-init.cpp
@@ -26,6 +26,6 @@ struct D : C { int d; };
constexpr C c1; // expected-error {{requires a user-provided default constructor}}
constexpr C c2 = C(); // ok
constexpr D d1; // expected-error {{requires a user-provided default constructor}}
-constexpr D d2 = D(); // expected-error {{constant expression}} expected-note {{non-literal type 'const D'}}
+constexpr D d2 = D(); // ok with DR1452
static_assert(D().c == 0, "");
static_assert(D().d == 0, "");
OpenPOWER on IntegriCloud