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 6547485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:50:12+00:00 2026-05-25T11:50:12+00:00

According to the C++03 standard, is it valid to have references to incomplete types?

  • 0

According to the C++03 standard, is it valid to have references to incomplete types? I’m not aware of any implementation that implements references as any other than non-null pointers, so such code ought to work. However, I wonder whether references to incomplete types are standard conforming.

I would appreciate answers with quotes and references to the C++ standard.

  • 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-25T11:50:12+00:00Added an answer on May 25, 2026 at 11:50 am

    The C++ standard doesn’t explicitly say, as far as I know, that you can have a reference to an incomplete type. But the standard does have a section that specifies when a type must be complete:

    3.2 One definition rule [basic.def.odr]

    4. Exactly one definition of a class is required in a translation
    unit if the class is used in a way that requires the class type to be
    complete. [Example: the following complete translation unit is
    well-formed, even though it never defines X:

        struct X;     // declare X as a struct type
        struct X* x1; // use X in pointer formation
        X* x2;        // use X in pointer formation
    

    —end example] [Note: the rules for declarations and expressions
    describe in which contexts complete class types are required. A class
    type T must be complete if:

    • an object of type T is defined (3.1, 5.3.4), or
    • an lvalue-to-rvalue conversion is applied to an lvalue referring to
      an object of type T (4.1), or
    • an expression is converted (either implicitly or explicitly) to
      type T (clause 4, 5.2.3, 5.2.7, 5.2.9, 5.4), or
    • an expression that is not a null pointer constant, and has type
      other than void * is converted to the type pointer to T or reference
      to T using an implicit conversion (clause 4), a dynamic_cast (5.2.7)
      or a static_cast (5.2.9), or
    • a class member access operator is applied to an expression of type
      T (5.2.5), or
    • the typeid operator (5.2.8) or the sizeof operator (5.3.3) is
      applied to an operand of type T, or
    • a function with a return type or argument type of type T is defined
      (3.1) or called (5.2.2), or
    • an lvalue of type T is assigned to (5.17). ]

    It appears that in every other case, including declarations of references to incomplete types, the type can be incomplete.

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

Sidebar

Related Questions

according to the HTML Standards ID-Attributes of any HTML Tag in a webpage have
This is just like struct hack. Is it valid according to standard C? //
What is the set of valid outputs for the following, according to the standard?
According to the Java standard the short and char types both use 2 bytes
I know that according to C++ standard in case the new fails to allocate
§3.10 section 9 says non-class rvalues always have cv-unqualified types. That made me wonder...
According to the standard, a conversion function has a function-id operator conversion-type-id , which
According to the OpenMP web site OpenMp is the de-facto standard for parallel programming
According to W3C standards, if you have a nillable element with a nil value,
According to the gcc docs , memcmp is not an intrinsic function of GCC.

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.