From e1aebe1e3aabe955e3805e994647e5e31dcc4d8c Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Fri, 19 Oct 2012 20:36:44 +0000 Subject: [PATCH] Pretty-print a ParenListExpr in a variable initializer correctly. Patch by Grzegorz Jablonski. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166311 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/DeclPrinter.cpp | 4 ++-- test/SemaCXX/ast-print.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp index 45280df812..386ad66c99 100644 --- a/lib/AST/DeclPrinter.cpp +++ b/lib/AST/DeclPrinter.cpp @@ -629,13 +629,13 @@ void DeclPrinter::VisitVarDecl(VarDecl *D) { ImplicitInit = D->getInitStyle() == VarDecl::CallInit && Construct->getNumArgs() == 0 && !Construct->isListInitialization(); if (!ImplicitInit) { - if (D->getInitStyle() == VarDecl::CallInit) + if ((D->getInitStyle() == VarDecl::CallInit) && !isa(Init)) Out << "("; else if (D->getInitStyle() == VarDecl::CInit) { Out << " = "; } Init->printPretty(Out, 0, Policy, Indentation); - if (D->getInitStyle() == VarDecl::CallInit) + if ((D->getInitStyle() == VarDecl::CallInit) && !isa(Init)) Out << ")"; } } diff --git a/test/SemaCXX/ast-print.cpp b/test/SemaCXX/ast-print.cpp index 5e89c8b548..e0c154a0ec 100644 --- a/test/SemaCXX/ast-print.cpp +++ b/test/SemaCXX/ast-print.cpp @@ -52,3 +52,11 @@ void test6() { unsigned int y = 0; test6fn((int&)y); } + +// CHECK: S s( 1, 2 ); + +template void test7() +{ + S s( 1,2 ); +} + -- 2.50.1