<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 - Regression where default template type parameters no longer reported"
href="https://bugs.llvm.org/show_bug.cgi?id=32539">32539</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Regression where default template type parameters no longer reported
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>libclang
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nfitzgerald@mozilla.com
</td>
</tr>
<tr>
<th>CC</th>
<td>klimek@google.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Given this test case with a template definition using a default template type
parameter:
```
template <typename T, typename U = int>
struct Foo {
T t;
U u;
};
static Foo<bool> bar;
```
In libclang 3.9, I get a cursor for `bar`'s template instantiation like this:
```
(
kind = StructDecl
spelling = "Foo"
location = ./tests/headers/default-template-parameter.hpp:2:8
is-definition? true
is-declaration? true
is-inlined-function? false
usr = "c:@S@Foo>#b#I"
number-of-template-args = 2
specialized.kind = ClassTemplate
specialized.spelling = "Foo"
specialized.location = ./tests/headers/default-template-parameter.hpp:2:8
specialized.is-definition? true
specialized.is-declaration? true
specialized.is-inlined-function? false
specialized.template-kind = StructDecl
specialized.usr = "c:@ST>2#T#T@Foo"
type.kind = Record
type.cconv = 100
type.spelling = "Foo<bool, int>"
type.number-of-template-args = 2
type.is-variadic? false
)
```
Then, using `clang_Type_getNumTemplateArguments` and
`clang_Type_getTemplateArgumentAsType`, I get these template arguments:
```
Type(spelling: bool, kind: Bool)
Type(spelling: int, kind: Int)
```
In contrast, with libclang >= 4.0, I get only the explicit template argument,
not the default type:
```
Type(spelling: bool, kind: Bool)
```
Here is the result of bisection on the git monorepo:
```
1cd3d77b9a8e18878a1654eb14053732b616b073 is the first bad commit
commit 1cd3d77b9a8e18878a1654eb14053732b616b073
Author: Argyrios Kyrtzidis <<a href="mailto:akyrtzi@gmail.com">akyrtzi@gmail.com</a>>
Date: Tue Nov 15 20:51:46 2016 +0000
[libclang] Generalize clang_getNumTemplateArguments and
clang_getTemplateArgumentAsType to other kind of specializations.
Patch by Emilio Cobos Álvarez!
<a href="https://reviews.llvm.org/D26663">https://reviews.llvm.org/D26663</a>
```</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>