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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:59:27+00:00 2026-05-26T13:59:27+00:00

ISO 98/03 standard (section 14.3.1) seems to forbid using a type with internal linkage

  • 0

ISO 98/03 standard (section 14.3.1) seems to forbid using a type with internal linkage as a template parameter. (See example below.) The C++11 standard does not.
G++ – using the old standard – is allowing it.
Am I misreading the 03 standard, or is g++ just letting this slide?

namespace
{
    struct hidden { };
}

template<typename T>
struct S
{
   T t;
};

int main()
{
    S<hidden> s;
    return 0;
}
  • 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-26T13:59:27+00:00Added an answer on May 26, 2026 at 1:59 pm

    You’re correct that C++03 doesn’t allow using a type with internal linkage as a template type parameter, while C++11 does.

    I seem to recall, however, that definitions inside the anonymous namespace still have external linkage.


    Yup, section 3.5 [basic.link] says

    A name having namespace scope (3.3.5) has internal linkage if it is the name of

    • an object, reference, function or function template that is explicitly declared static or,
    • an object or reference that is explicitly declared const and neither explicitly declared extern nor previously declared to have external linkage; or
    • a data member of an anonymous union.

    A name having namespace scope has external linkage if it is the name of

    • an object or reference, unless it has internal linkage; or
    • a function, unless it has internal linkage; or
    • a named class (clause 9), or an unnamed class defined in a typedef declaration in which the class has the typedef name for linkage purposes (7.1.3); or
    • a named enumeration (7.2), or an unnamed enumeration defined in a typedef declaration in which the enumeration has the typedef name for linkage purposes (7.1.3); or
    • an enumerator belonging to an enumeration with external linkage; or
    • a template, unless it is a function template that has internal linkage (clause 14); or
    • a namespace (7.3), unless it is declared within an unnamed namespace.

    You have a named class at namespace scope, it has external linkage.

    And the footnote on the bottom of page 115 of ISO/IEC 14882:2003 clarifies:

    Although entities in an unnamed namespace might have external linkage, they are effectively qualified by a name unique to their translation unit and therefore can never be seen from any other translation unit.

    If you have another version, try looking in section 7.3.1.1 [namespace.unnamed]

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

Sidebar

Related Questions

Does anyone know the ISO standard that covers .NET 3.5? I found ISO/IEC 23270:2006,
This is the statement from ISO C++ Standard 14.6.2.1: Dependent types : A type
I did my document in an ISO-standard. It does not support umlaut alphabets, such
Does ISO C++ standard mandate any sort of destruction order of objects inside STL
The C standard (ISO/IEC 9899:2011 or 9899:1999) defines a type ptrdiff_t in <stddef.h> .
This is the statement from ISO C++ Standard 14.6.2.4: Dependent template arguments : A
I've written my own qr code generator. I followed both the ISO standard as
The C standard states: ISO/IEC 9899:1999, 6.2.5.15 (p. 49) The three types char, signed
It is not clear from the PDF ISO standard document (PDF32000-2008) whether a comment
I've just spotted the following in the C99 ISO standard, 7.19.6.1 The fprintf function

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.