Title
Local types in inline functions with external linkage
Status
cd2
Section
9.2.3 [dcl.fct.spec]
Submitter
Mike Miller

Created on 2009-02-06.00:00:00 last changed 178 months ago

Messages

Date: 2010-03-15.00:00:00

[Voted into WP at March, 2010 meeting.]

Date: 2009-11-15.00:00:00

Proposed resolution (November, 2009):

Change 9.2.3 [dcl.fct.spec] paragraph 4 as follows:

...A static local variable in an extern inline function always refers to the same object. A string literal in the body of an extern inline function is the same object in different translation units. [Note: A string literal appearing in a default argument expression is not in the body of an inline function merely because the expression is used in a function call from that inline function. —end note] A type defined within the body of an extern inline function is the same type in every translation unit.
Date: 2009-07-15.00:00:00

Notes from the July, 2009 meeting:

The types are intended to be the same.

Date: 2009-02-06.00:00:00

9.2.3 [dcl.fct.spec] paragraph 4 specifies that local static variables and string literals appearing in the body of an inline function with external linkage must be the same entities in every translation unit in the program. Nothing is said, however, about whether local types are likewise required to be the same.

Although a conforming program could always have determined this by use of typeid, recent changes to C++ (allowing local types as template type arguments, lambda expression closure classes) make this question more pressing.

History
Date User Action Args
2010-03-29 00:00:00adminsetmessages: + msg2683
2010-03-29 00:00:00adminsetstatus: tentatively ready -> cd2
2010-02-16 00:00:00adminsetmessages: + msg2498
2010-02-16 00:00:00adminsetstatus: drafting -> tentatively ready
2009-03-23 00:00:00adminsetmessages: + msg1949
2009-03-23 00:00:00adminsetstatus: open -> drafting
2009-02-06 00:00:00admincreate