Hadatko / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

EXPECT_EQ must have "()" around template function #340

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
IMPORTANT NOTE: Before you create an issue, please first search the issue
tracker to see if it has been reported.  If you believe it's a new issue,
please send it to
googletestframework@googlegroups.com (you need to first join the
group at
http://groups.google.com/group/googletestframework).  You'll get an answer
much faster that way, as the issue tracker is NOT regularly monitored.

When creating a new issue, please provide the information asked for below.
The more detailed your answer, the more likely the bug will be fixed.

Finally, Google Test is community-supported now, meaning that no one
officially works on it, and everyone is expected to help.  It will be
appreciated if you investigate the problem yourself and contribute a patch
in addition to creating the issue.

What steps will reproduce the problem?

here is the code using VS.net 2005 :

template<typename T, int postion>
bool ListCheck(const vector<T> &t1, const T n1)
{
    return t1[postion] == n1;
};

void foo()
{
    vector <DRINK> d;
    EXPECT_EQ((ListCheck<DRINK, 200>(d, TEA)), true);
}

What is the expected output? What do you see instead?

if donot use "()" around ListCheck<DRINK, 200>(d, TEA), there will be many 
compile erros,such as :

e:\eula\ut\ut_einstein.cpp(91) : error C2143: syntax error : missing ',' before 
')'
1>e:\eula\ut\ut_einstein.cpp(91) : error C2059: syntax error : ')'
1>e:\eula\ut\ut_einstein.cpp(91) : error C2059: syntax error : ')'
1>e:\eula\ut\ut_einstein.cpp(91) : error C2039: 'Compare' : is not a member of 
'`global namespace''
1>e:\eula\ut\ut_einstein.cpp(91) : error C2143: syntax error : missing ',' 
before ')'
1>e:\eula\ut\ut_einstein.cpp(91) : error C2059: syntax error : ')'
1>e:\eula\ut\ut_einstein.cpp(91) : error C2059: syntax error : ')'
1>e:\eula\ut\ut_einstein.cpp(91) : error C2143: syntax error : missing ',' 
before ')'
1>e:\eula\ut\ut_einstein.cpp(92) : error C2143: syntax error : missing ';' 
before '}'
1>e:\eula\ut\ut_einstein.cpp(93) : error C2143: syntax error : missing ';' 
before '}'
1>e:\eula\ut\ut_einstein.cpp(93) : fatal error C1004: unexpected end-of-file 
found

What version of Google Test are you using? On what operating system?
1.5, winXP

Please provide any additional information below, such as a code snippet.

Original issue reported on code.google.com by zhang....@huawei.com on 6 Dec 2010 at 3:14

GoogleCodeExporter commented 9 years ago

Original comment by w...@google.com on 6 Dec 2010 at 4:02