[llvm-bugs] [Bug 41531] New: Wrong InitializationStyle for auto x(10);
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Apr 18 00:33:11 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=41531
Bug ID: 41531
Summary: Wrong InitializationStyle for auto x(10);
Product: clang
Version: 8.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: karos at absint.com
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
Created attachment 21796
--> https://bugs.llvm.org/attachment.cgi?id=21796&action=edit
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
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190418/791efb66/attachment.html>
More information about the llvm-bugs
mailing list