<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Wrong InitializationStyle for auto x(10);"
href="https://bugs.llvm.org/show_bug.cgi?id=41531">41531</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong InitializationStyle for auto x(10);
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>8.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>karos@absint.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=21796" name="attach_21796" title="Minimal example file to reproduce the issue">attachment 21796</a> <a href="attachment.cgi?id=21796&action=edit" title="Minimal example file to reproduce the issue">[details]</a></span>
Minimal example file to reproduce the issue
It looks like the clang-8 AST holds the wrong InitializationStyle for
declarations with call-style initialization and type auto, i.e. auto x(10);
gets the initialization style 'listinit' instead of 'callinit'.
This seems to be a regression introduced with clang 8 and affects at least the
AST dump and any user of libclang relying on VarDecl::getInitStyle(). See
below:
Minimal example (attached):
===========================
int main(){
auto callinit(0);
auto listinit{0};
}
clang-8 -Xclang -ast-dump -fsyntax-only:
========================================
TranslationUnitDecl 0x632bdc8 <<invalid sloc>> <invalid sloc>
| [...]
`-FunctionDecl 0x6367e40 </tmp/test.cpp:1:1, line:4:1> line:1:5 main 'int ()'
`-CompoundStmt 0x6368270 <col:11, line:4:1>
|-DeclStmt 0x63680f0 <line:2:5, col:21>
| `-VarDecl 0x6367f80 <col:5, col:19> col:10 callinit 'int':'int' listinit
| `-IntegerLiteral 0x6367fe0 <col:19> 'int' 0
`-DeclStmt 0x6368258 <line:3:5, col:21>
`-VarDecl 0x6368118 <col:5, col:19> col:10 listinit 'int':'int' listinit
`-IntegerLiteral 0x6368178 <col:19> 'int' 0
clang-7 -Xclang -ast-dump -fsyntax-only:
========================================
TranslationUnitDecl 0x20e10e8 <<invalid sloc>> <invalid sloc>
| [...]
`-FunctionDecl 0x211ba28 </tmp/test.cpp:1:1, line:4:1> line:1:5 main 'int ()'
`-CompoundStmt 0x211beb8 <col:11, line:4:1>
|-DeclStmt 0x211bcf0 <line:2:5, col:21>
| `-VarDecl 0x211bb70 <col:5, col:19> col:10 callinit 'int':'int' callinit
| `-IntegerLiteral 0x211bbd0 <col:19> 'int' 0
`-DeclStmt 0x211bea0 <line:3:5, col:21>
`-VarDecl 0x211bd18 <col:5, col:20> col:10 listinit 'int':'int' listinit
`-InitListExpr 0x211be58 <col:18, col:20> 'int':'int'
`-IntegerLiteral 0x211bd78 <col:19> 'int' 0</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>