Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kdwsdl2cpp: Constructor of generated client should be marked explicit #206

Closed
mg34343 opened this issue Feb 26, 2020 · 2 comments
Closed

Comments

@mg34343
Copy link

mg34343 commented Feb 26, 2020

kdwsdl2cpp generates constructors like this:

ClientName( QObject* _parent = nullptr );

The constructor should be marked as explicit so it will not be considered as a converting constructor:

explicit ClientName( QObject* _parent = nullptr );

Motivation:
Just had to debug a problem in my code where I accidentally called a function that expected a ClientName& with a ClientName* instead, which resulted in the function being called with a new ClientName that had the original set as parent. With the change these sort of mistakes would result in a compiler error instead. Qt has all constructors with a single QObject* parameter marked as explicit for this reason.

@dfaure-kdab
Copy link
Member

@martonmiklos interested in adding this to libkode?

@martonmiklos
Copy link
Contributor

@dfaure-kdab
Absolutely, I will come up with a PR to support explicit specifier for functions.

martonmiklos added a commit to martonmiklos/libkode that referenced this issue Mar 1, 2022
martonmiklos added a commit to martonmiklos/libkode that referenced this issue Mar 1, 2022
martonmiklos added a commit to martonmiklos/libkode that referenced this issue Mar 1, 2022
martonmiklos added a commit to martonmiklos/libkode that referenced this issue Mar 1, 2022
dfaure-kdab pushed a commit to cornelius/libkode that referenced this issue Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants