Implement the initial part of C++0x [expr.const]p2, which specifies
that the unevaluated subexpressions of &&, ||, and ? : are not
considered when determining whether the expression is a constant
expression. Also, turn the "used in its own initializer" warning into
a runtime-behavior warning, so that it doesn't fire when a variable is
used as part of an unevaluated subexpression of its own initializer.
Fixes PR9999.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131968 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 3965a45..7bcd205 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -5149,9 +5149,11 @@
if (OrigDecl != ReferenceDecl) return;
LookupResult Result(S, DRE->getNameInfo(), Sema::LookupOrdinaryName,
Sema::NotForRedeclaration);
- S.Diag(SubExpr->getLocStart(), diag::warn_uninit_self_reference_in_init)
- << Result.getLookupName() << OrigDecl->getLocation()
- << SubExpr->getSourceRange();
+ S.DiagRuntimeBehavior(SubExpr->getLocStart(), SubExpr,
+ S.PDiag(diag::warn_uninit_self_reference_in_init)
+ << Result.getLookupName()
+ << OrigDecl->getLocation()
+ << SubExpr->getSourceRange());
}
};
}