Bug 33520 - Usage of extern inline functions violates C++ standard dcl 7.1.2 (4)
Summary: Usage of extern inline functions violates C++ standard dcl 7.1.2 (4)
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.2
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-21 18:35 UTC by Artem Frolov
Modified: 2007-09-21 18:47 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Artem Frolov 2007-09-21 18:35:58 UTC
According to C++ standard 7.1.2 (4):
An inline function shall be defined in every translation unit in which
it  is  used  and shall have exactly the same definition in every case

For the following code:
---------
inline.cc
---------
#include <stdio.h>

inline void foo() {
    printf("Hey!\n");
}

void bar() {
    foo();
}
----------
main.cc
----------
extern void foo();
int main() {
    foo();
    return 0;
}
----------

g++ -std=c++98 main.cc inline.cc

creates a program and does not report any violation of the standard.
Comment 1 Andrew Pinski 2007-09-21 18:43:14 UTC
I think it also mentions in the same pargraph that this violation does not have to be diagnostic.
Comment 2 Andrew Pinski 2007-09-21 18:47:12 UTC
In fact it does.

This is a hard bug to fix without all translation units aviable at compile time.
So I am going to close as won't fix.