[cfe-commits] r130007 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/scope-check.cpp
Chandler Carruth
chandlerc at gmail.com
Fri Apr 22 12:01:39 PDT 2011
Author: chandlerc
Date: Fri Apr 22 14:01:39 2011
New Revision: 130007
URL: http://llvm.org/viewvc/llvm-project?rev=130007&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/scope-check.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=130007&r1=130006&r2=130007&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Apr 22 14:01:39 2011
@@ -5235,7 +5235,7 @@
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 @@
// 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
Modified: cfe/trunk/test/SemaCXX/scope-check.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/scope-check.cpp?rev=130007&r1=130006&r2=130007&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/scope-check.cpp (original)
+++ cfe/trunk/test/SemaCXX/scope-check.cpp Fri Apr 22 14:01:39 2011
@@ -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 @@
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;
+ }
+ }
+}
More information about the cfe-commits
mailing list