C++: regression test for extractor bug with enum in template class

This commit is contained in:
Nick Rolfe
2018-08-23 17:48:24 +01:00
parent 193e013196
commit 7cf550a70f
3 changed files with 29 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
// A regression test for a bug extracting the enum constants in a template
// class.
template <class>
class C {
enum { foo, bar, baz } delim;
void f();
};
template <class T>
void C<T>::f() {
switch (delim) {
case bar:
break;
case baz:
break;
case foo:
break;
}
}
template class C<int>;

View File

@@ -0,0 +1,2 @@
| test.cpp:13:3:20:3 | switch (...) ... | 3 |
| test.cpp:13:3:20:3 | switch (...) ... | 3 |

View File

@@ -0,0 +1,4 @@
import cpp
from SwitchStmt ss
select ss, count(SwitchCase sc | ss = sc.getSwitchStmt())