summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-04-22 19:01:39 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-04-22 19:01:39 +0000
commit56773db7d407d2016bf70904052e7b0e73b60d09 (patch)
treee73020de6d4c2fa8be729332db0ee375393d16dc /clang
parent8e4be0b1ea01f54b16f7aab671f52739735ead20 (diff)
downloadbcm5719-llvm-56773db7d407d2016bf70904052e7b0e73b60d09.tar.gz
bcm5719-llvm-56773db7d407d2016bf70904052e7b0e73b60d09.zip
I concur with DPG here. This does indeed apply in 0x mode. Added test
cases that demonstrates exactly why this does indeed apply in 0x mode. If isPOD is currently broken in 0x mode, we should fix that directly rather than papering over it here. llvm-svn: 130007
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp3
-rw-r--r--clang/test/SemaCXX/scope-check.cpp20
2 files changed, 21 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index e2e43c2912a..611031b4bd3 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5235,7 +5235,7 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl,
const RecordType *Record
= Context.getBaseElementType(Type)->getAs<RecordType>();
- if (Record && getLangOptions().CPlusPlus && !getLangOptions().CPlusPlus0x &&
+ if (Record && getLangOptions().CPlusPlus &&
cast<CXXRecordDecl>(Record->getDecl())->isPOD()) {
// C++03 [dcl.init]p9:
// If no initializer is specified for an object, and the
@@ -5248,7 +5248,6 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl,
// any, have an indeterminate initial value); if the object
// or any of its subobjects are of const-qualified type, the
// program is ill-formed.
- // FIXME: DPG thinks it is very fishy that C++0x disables this.
} else {
// Check for jumps past the implicit initializer. C++0x
// clarifies that this applies to a "variable with automatic
diff --git a/clang/test/SemaCXX/scope-check.cpp b/clang/test/SemaCXX/scope-check.cpp
index d462af06d73..3a90cc08f6a 100644
--- a/clang/test/SemaCXX/scope-check.cpp
+++ b/clang/test/SemaCXX/scope-check.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s -Wno-unreachable-code
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -std=gnu++0x %s -Wno-unreachable-code
namespace test0 {
struct D { ~D(); };
@@ -151,3 +152,22 @@ namespace test8 {
l2: x++;
}
}
+
+namespace test9 {
+ struct S { int i; };
+ void test1() {
+ goto foo;
+ S s;
+ foo:
+ return;
+ }
+ unsigned test2(unsigned x, unsigned y) {
+ switch (x) {
+ case 2:
+ S s;
+ if (y > 42) return x + y;
+ default:
+ return x - 2;
+ }
+ }
+}
OpenPOWER on IntegriCloud