From a935179ab73cfc638aba932eff341dcaafd17440 Mon Sep 17 00:00:00 2001 From: Sebastian Redl Date: Sat, 11 Feb 2012 23:51:47 +0000 Subject: Represent C++ direct initializers as ParenListExprs before semantic analysis instead of having a special-purpose function. - ActOnCXXDirectInitializer, which was mostly duplication of AddInitializerToDecl (leading e.g. to PR10620, which Eli fixed a few days ago), is dropped completely. - MultiInitializer, which was an ugly hack I added, is dropped again. - We now have the infrastructure in place to distinguish between int x = {1}; int x({1}); int x{1}; -- VarDecl now has getInitStyle(), which indicates which of the above was used. -- CXXConstructExpr now has a flag to indicate that it represents list- initialization, although this is not yet used. - InstantiateInitializer was renamed to SubstInitializer and simplified. - ActOnParenOrParenListExpr has been replaced by ActOnParenListExpr, which always produces a ParenListExpr. Placed that so far failed to convert that back to a ParenExpr containing comma operators have been fixed. I'm pretty sure I could have made a crashing test case before this. The end result is a (I hope) considerably cleaner design of initializers. More importantly, the fact that I can now distinguish between the various initialization kinds means that I can get the tricky generalized initializer test cases Johannes Schaub supplied to work. (This is not yet done.) This commit passed self-host, with the resulting compiler passing the tests. I hope it doesn't break more complicated code. It's a pretty big change, but one that I feel is necessary. llvm-svn: 150318 --- clang/test/SemaTemplate/nested-incomplete-class.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 clang/test/SemaTemplate/nested-incomplete-class.cpp (limited to 'clang/test/SemaTemplate/nested-incomplete-class.cpp') diff --git a/clang/test/SemaTemplate/nested-incomplete-class.cpp b/clang/test/SemaTemplate/nested-incomplete-class.cpp new file mode 100644 index 00000000000..a4bfccb8d27 --- /dev/null +++ b/clang/test/SemaTemplate/nested-incomplete-class.cpp @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -fsyntax-only %s + +template +struct foo { + struct bar; + + bar fn() { + // Should not get errors about bar being incomplete here. + bar b = bar(1, 2); + return b; + } +}; + +template +struct foo::bar { + bar(int, int); +}; + +void fn() { + foo().fn(); +} -- cgit v1.2.3