Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7499629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:53:32+00:00 2026-05-29T19:53:32+00:00

I recently found out that the types of parameters in a non-defining function declaration

  • 0

I recently found out that the types of parameters in a non-defining function declaration may be of incomplete types. This is very exciting.

class A;
class B {
   B(A a);      // Legal! Wow!
};

The type is required to be complete only for the definition:

B::B(A a) {};   // error: ‘a’ has incomplete type

I’ve been trying to pin down the legalese for this, but my searches through C++11 for “[in]complete type” have yielded nothing of much interest, leading me to assume that these semantics are defined through an enigmatic maze of constructions.

Can you help me pin down the standard text that defines the above requirements for the types of function parameters being complete or otherwise, in function declarations vs definitions?

(9.2/10 and 9.4.2/2 give us the requirements for static data member declarations and non-static data member definitions in class definitions.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T19:53:34+00:00Added an answer on May 29, 2026 at 7:53 pm

    Function declaration

    There doesn’t appear to be anything directly addressing this. It may be that it’s allowed because it is not disallowed.

    7.1.1/9 tells us that it’s ok for an extern declaration (which is semantically similar to a member function declaration), and shows us non-normatively that types in such declarations may be incomplete:

    [C++11: 7.1.1/9]: The name of a declared but undefined class can be used in an extern declaration. Such a declaration can only be used in ways that do not require a complete class type. [ Example:

    struct S;
    extern S a;
    extern S f();
    extern void g(S);
    void h() {
      g(a); // error: S is incomplete
      f(); // error: S is incomplete
    }
    

    —end example ]

    Function definition (thanks litb)

    [C++11: 8.3.5/9]: Types shall not be defined in return or parameter types. The type of a parameter or the return type for a function definition shall not be an incomplete class type (possibly cv-qualified) unless the function definition is nested within the member-specification for that class (including definitions in nested classes defined within
    the class).

    Function call

    [C++11: 5.2.2/4]: [..] When a function is called, the parameters that have object type shall have completely-defined object type. [ Note: this still allows a parameter to be a pointer or reference to an incomplete class type. However, it prevents a passed-by-value parameter to have an incomplete class type. —end note ] [..]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The obvious answer is to use Charset.defaultCharset() but we recently found out that this
I recently found out that gcc allows the definition of nested function. In my
I have recently found out that there exists a method called nth_element in the
Recently I found out that there are several things that one can do to
I found out recently that JList (finally!) was generified in JDK7. Why JTree and
I recently asked a question about IIf vs. If and found out that there
I recently found out about C# extension methods and wrote this one: /// <summary>
I recently found out that you can fake directory structure on S3 by putting
I've been using eval in my code and I recently found out that there
First sorry for the english. I've recently found out that the MessageBox from Windows.Forms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.