http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53716

             Bug #: 53716
           Summary: Intentional or bug? Inconsistencies in error
                    diagnostics in function redeclaration involving
                    stdcall attribute
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: mib.bugzi...@gmail.com


Two questions about diagnostics on templated/non-templated function
redeclarations and the presence of attribute stdcall

Question 1:

// no error for non template function redeclaration, i.e.:
void __attribute((stdcall)) f(int);
void f(int) {;} // compiles fine

// but on x86, g++ 4.6 and later give an error if function is a template --
Why?
template <class T> void __attribute__((stdcall)) f2(int);
template <class T> void f2(int) {;} // error here?

test3.c:2:31: error: new declaration âtemplate<class T> void f2(int)â
test3.c:1:50: error: ambiguates old declaration âtemplate<class T> void
f2(int)â

Question 2:
On x86 (not x64) this test case gets an error when compiled with gcc 4.6.2, but
there is no error when compiled with g++. Is this intentional or should an
error be produced in g++ as well?

% cat test2.c
// no error for non template function redeclaration, i.e.:
 void __attribute((stdcall)) f(int);
 void f(int a) {;} // compiles fine

gcc -c test2.c
test2.c:3:7: error: conflicting types for âfâ
test2.c:2:30: note: previous declaration of âfâ was here

% g++ -c test2.c
// no error

Reply via email to