OK, solved!!!
the correct line should be:
RegClass(int param, const char * theName) { printf("c-tor (%d,%s)\r\n", param, theName); }
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi to all,
I'm trying to write a simple code and it won't compile!
Any ideas?
#include <stdio.h>
class RegClass {
public:
RegClass(int param, char * theName) { printf("c-tor (%d,%s)\r\n", param, theName); }
};
class Test {
public:
int a;
RegClass Reg { 5 , "a string" };
};
int main() {
Test t;
t.a = 5;
return 0;
}
OK, solved!!!
the correct line should be:
RegClass(int param, const char * theName) { printf("c-tor (%d,%s)\r\n", param, theName); }
Hi, @S. Beniashvili
The error is due to /permissive- (Standards conformance) option.
The
/permissive-
option sets the/Zc:referenceBinding
,/Zc:strictStrings
, and/Zc:rvalueCast
options to conforming behavior.
/Zc:strictStrings:
const char * theName
When specified, the compiler requires strict const
-qualification conformance for pointers initialized by using string literals.
Best regards,
Minxin Yu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.