Getting rid of [dcc32 Warning] W1029 Duplicate constructor ‘ClassName.ConstructorName’ with identical parameters will be inacessible from C++
Posted by jpluimers on 2017/11/30
Note that the below solution works for any project raising the W1029 warning (not just from projects using Delphi Mocks) like
[dcc32 Warning] W1029 Duplicate constructor 'ClassName.ConstructorName' with identical parameters will be inacessible from C++
From my original text at [WayBack] Get rid of W1029 warning in Delphi compile mode · Issue #106 · VSoftTechnologies/Delphi-Mocks · GitHub:
By default the compiler will emit warnings like these for projects when using either of the
Delphi.Mocks.Behavior
orDelphi.Mocks.Expectation
directly or indirectly:
[dcc32 Warning] W1029 Duplicate constructor 'TExpectation.CreateOnceWhen' with identical parameters will be inacessible from C++
They’re harmless as DUnitX doesn’t support C++. This particular warning type cannot be disabled on the unit or source line level which means you have to disable it on the project level by either:
- adding
{$WARN DUPLICATE_CTOR_DTOR OFF}
anywhere to your.dpr
project file- modifying the the Project Options for your project (easiest is in the
All configurations - All platforms
target):
- follow the path
Delphi Compiler
,Hints and Warnings
in the treeview on the left- expand the
Output warnings
node in the listview on the right- set
Duplicate constructor/destructor with identical parameters will be inacessible from C++
toError
A screenshot of the second option is below.
Note that the spelling mistake in
Duplicate constructor/destructor with identical parameters will be inacessible from C++
is how it is in the IDE, but that as Google search string it will give limited results, so here are some back-ground references:
- Delphi 2007: Duplicate %s ‘%s’ with identical parameters will be inacessible from C++ (W1029)
- Delphi 2009: W1029: Duplicate %s ‘%s’ with identical parameters will be inacessible from C++ (Delphi)
- Delphi 2010 and up: W1029 Duplicate %s ‘%s’ with identical parameters will be inacessible from C++ (Delphi)
- Explanation about W1029: Useful reference about disabling specific compiler warnings
- Delphi XE2’s hidden hints and warnings options
- On warning W1029: Duplicate constructor warning in Delphi XE2
–jeroen
Leave a Reply