<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 - AST printer duplicates templated constexpr variable specializetions"
href="https://bugs.llvm.org/show_bug.cgi?id=44510">44510</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>AST printer duplicates templated constexpr variable specializetions
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>N.James93@hotmail.co.uk
</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>templated constexpr variables appear twice in the AST dump
observe
➜ ~ cat test.cpp
template<typename T> constexpr int x = 0;
constexpr int x_int = x<int>;
➜ ~ clang++ --version
clang version 10.0.0 (<a href="mailto:git@github.com">git@github.com</a>:llvm/llvm-project.git
c5f844a49f2e95eb4c5a3a9e44ffe79633729636)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
➜ ~ clang++ -Xclang -ast-dump -fsyntax-only -o /dev/stdout test.cpp
TranslationUnitDecl 0x6d7ff38 <<invalid sloc>> <invalid sloc>
|-TypedefDecl 0x6d80810 <<invalid sloc>> <invalid sloc> implicit __int128_t
'__int128'
| `-BuiltinType 0x6d804d0 '__int128'
|-TypedefDecl 0x6d80880 <<invalid sloc>> <invalid sloc> implicit __uint128_t
'unsigned __int128'
| `-BuiltinType 0x6d804f0 'unsigned __int128'
|-TypedefDecl 0x6d80bf8 <<invalid sloc>> <invalid sloc> implicit
__NSConstantString '__NSConstantString_tag'
| `-RecordType 0x6d80970 '__NSConstantString_tag'
| `-CXXRecord 0x6d808d8 '__NSConstantString_tag'
|-TypedefDecl 0x6d80c90 <<invalid sloc>> <invalid sloc> implicit
__builtin_ms_va_list 'char *'
| `-PointerType 0x6d80c50 'char *'
| `-BuiltinType 0x6d7ffd0 'char'
|-TypedefDecl 0x6dbdc18 <<invalid sloc>> <invalid sloc> implicit
__builtin_va_list '__va_list_tag [1]'
| `-ConstantArrayType 0x6dbdbc0 '__va_list_tag [1]' 1
| `-RecordType 0x6d80d80 '__va_list_tag'
| `-CXXRecord 0x6d80ce8 '__va_list_tag'
|-VarTemplateDecl 0x6dbddb0 <test.cpp:1:1, col:40> col:36 x
| |-TemplateTypeParmDecl 0x6dbdc70 <col:10, col:19> col:19 typename depth 0
index 0 T
| |-VarDecl 0x6dbdd48 <col:22, col:40> col:36 x 'const int' constexpr cinit
| | `-IntegerLiteral 0x6dbde50 <col:40> 'int' 0
| `-VarTemplateSpecializationDecl 0x6dbe040 <col:22, col:40> col:36 referenced
x 'const int' constexpr cinit
| |-TemplateArgument type 'int'
| `-IntegerLiteral 0x6dbde50 <col:40> 'int' 0
|-VarDecl 0x6dbdee0 <line:2:1, col:28> col:15 x_int 'const int' constexpr cinit
| `-ImplicitCastExpr 0x6dbe3a8 <col:23, col:28> 'int' <LValueToRValue>
| `-DeclRefExpr 0x6dbe348 <col:23, col:28> 'const int' lvalue
VarTemplateSpecialization 0x6dbe040 'x' 'const int' non_odr_use_constant
`-VarTemplateSpecializationDecl 0x6dbe040 <line:1:22, col:40> col:36 referenced
x 'const int' constexpr cinit
|-TemplateArgument type 'int'
`-IntegerLiteral 0x6dbde50 <col:40> 'int' 0
➜ ~
VarTemplateSpecialization appears twice with the exact same declaration, bar
one specifies the line number</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>