Skip to content

Commit a58fb60

Browse files
committed
C++: regression test for extractor bug with enum in template class
1 parent 50acf72 commit a58fb60

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
// A regression test for a bug extracting the enum constants in a template
3+
// class.
4+
5+
template <class>
6+
class C {
7+
enum { foo, bar, baz } delim;
8+
void f();
9+
};
10+
11+
template <class T>
12+
void C<T>::f() {
13+
switch (delim) {
14+
case bar:
15+
break;
16+
case baz:
17+
break;
18+
case foo:
19+
break;
20+
}
21+
}
22+
23+
template class C<int>;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| test.cpp:13:3:20:3 | switch (...) ... | 3 |
2+
| test.cpp:13:3:20:3 | switch (...) ... | 3 |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import cpp
2+
3+
from SwitchStmt ss
4+
select ss, count(SwitchCase sc | ss = sc.getSwitchStmt())

0 commit comments

Comments
 (0)