A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/cplusplus/CWG/issues/510 below:

CWG2871 [class.default.ctor] p1 should cover the constructor template · Issue #510 · cplusplus/CWG · GitHub

Full name of submitter (unless configured in github; will be published with the issue): Jim X

[class.default.ctor] p1 says:

If there is no user-declared constructor for class X, a non-explicit constructor having no parameters is implicitly declared as defaulted ([dcl.fct.def]).

Consider this example:

struct X{
  template<class U> X(U){} // #2
};
int main(){
   X x;  // #1
}

#1 is ill-formed since no matching function for call to 'X::X()'. [class.default.ctor] p1 should cover this example, however, #2 is a user-declared constructor template, and the implicitly instantiated declaration is not user-declared anyway.

Suggested Resolution

If there is no user-declared constructor or constructor template for class X, a non-explicit constructor having no parameters is implicitly declared as defaulted ([dcl.fct.def]).

t3nsor and frederick-vs-ja


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4