Tokenizer: don't set varid on c++11 'template using' type.

This commit is contained in:
Daniel Marjamäki 2016-08-02 15:04:07 +02:00
parent 612e83d5af
commit cc62259103
2 changed files with 11 additions and 1 deletions

View File

@ -2548,7 +2548,7 @@ static const std::set<std::string> notstart_c = make_container< std::set<std::st
<< "goto" << "NOT" << "return" << "sizeof"<< "typedef";
static const std::set<std::string> notstart_cpp = make_container< std::set<std::string> > ()
<< notstart_c
<< "delete" << "friend" << "new" << "throw" << "using" << "virtual" << "explicit" << "const_cast" << "dynamic_cast" << "reinterpret_cast" << "static_cast" ;
<< "delete" << "friend" << "new" << "throw" << "using" << "virtual" << "explicit" << "const_cast" << "dynamic_cast" << "reinterpret_cast" << "static_cast" << "template";
void Tokenizer::setVarIdPass1()
{

View File

@ -134,6 +134,7 @@ private:
TEST_CASE(varid_templateNamespaceFuncPtr); // #4172
TEST_CASE(varid_templateArray);
TEST_CASE(varid_templateParameter); // #7046 set varid for "X": std::array<int,X> Y;
TEST_CASE(varid_templateUsing); // #5781 #7273
TEST_CASE(varid_cppcast); // #6190
TEST_CASE(varid_variadicFunc);
TEST_CASE(varid_typename); // #4644
@ -2026,6 +2027,15 @@ private:
tokenize(code));
}
void varid_templateUsing() { // #5781 #7273
const char code[] = "template<class T> using X = Y<T>;\n"
"X<int> x;";
ASSERT_EQUALS("1: template < class T > using X ; X = Y < T > ;\n" // TODO: "1: \n"
"2: X < int > x@1 ;\n", // TODO: "2: Y<int> x@1 ;"
tokenize(code));
}
void varid_cppcast() {
ASSERT_EQUALS("1: const_cast < int * > ( code ) [ 0 ] = 0 ;\n",
tokenize("const_cast<int *>(code)[0] = 0;"));