[llvm-bugs] [Bug 44510] New: AST printer duplicates templated constexpr variable specializetions

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 10 06:47:25 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=44510

            Bug ID: 44510
           Summary: AST printer duplicates templated constexpr variable
                    specializetions
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: N.James93 at hotmail.co.uk
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

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 (git at github.com: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

-- 
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/20200110/f3dbe516/attachment.html>


More information about the llvm-bugs mailing list