You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Defining a variable named T inside a TEST_CASE with DOCTEST_CONFIG_DISABLE defined gives the following errors
main.cpp: In function ‘void _DOCTEST_ANON_FUNC_1()’:
main.cpp:7:12: error: declaration of ‘double T’ shadows template parameter
double T = 273.15; // "declaration of 'double T' shadows template parameter"
^
In file included from main.cpp:3:0:
doctest.h:2729:15: note: template parameter ‘T’ declared here
template <typename T> \
^
doctest.h:2734:5: note: in expansion of macro ‘DOCTEST_CREATE_AND_REGISTER_FUNCTION’
DOCTEST_CREATE_AND_REGISTER_FUNCTION(DOCTEST_ANONYMOUS(_DOCTEST_ANON_FUNC_), name)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
doctest.h:2968:19: note: in expansion of macro ‘DOCTEST_TEST_CASE’
#define TEST_CASE DOCTEST_TEST_CASE
^~~~~~~~~~~~~~~~~
main.cpp:5:1: note: in expansion of macro ‘TEST_CASE’
TEST_CASE("test")
^~~~~~~~~
It seems like the section around line 2734 is not disabled even if DOCTEST_CONFIG_DISABLE is defined. Perhaps that's part of the problem?
Steps to reproduce
#defineDOCTEST_CONFIG_DISABLE
#defineDOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include"doctest.h"TEST_CASE("test")
{
double T = 273.15; // "declaration of 'double T' shadows template parameter"
}
Compile using g++ -Wall main.cpp -o main using g++ version 6.3.0.
Extra information
doctest version: v1.2.2
Operating System: Debian 9 Stretch
Compiler+version: g++ 6.3.0
The text was updated successfully, but these errors were encountered:
hmmm I'll have to fix this - when DOCTEST_CONFIG_DISABLE is used all test cases are turned into uninstantiated templates with T as the typename parameter - I'll change it to _DOCTEST_DISABLED_TEST_CASE_PARAMETER or something like that. Thanks for reporting!
onqtam
changed the title
Defining a variable T inside a test with DOCTEST_CONFIG_DISABLE defined does not compile
[bug] Defining a variable T inside a test with DOCTEST_CONFIG_DISABLE defined does not compile
Sep 20, 2017
Description
Defining a variable named
T
inside aTEST_CASE
withDOCTEST_CONFIG_DISABLE
defined gives the following errorsIt seems like the section around line 2734 is not disabled even if
DOCTEST_CONFIG_DISABLE
is defined. Perhaps that's part of the problem?Steps to reproduce
Compile using
g++ -Wall main.cpp -o main
using g++ version 6.3.0.Extra information
The text was updated successfully, but these errors were encountered: