Bug 29823 - attribute((sentinel)) warning does not trigger for member function template
Summary: attribute((sentinel)) warning does not trigger for member function template
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: 4.9.0
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2006-11-14 03:25 UTC by Markus F.X.J. Oberhumer
Modified: 2021-10-01 10:35 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.9.4
Known to fail: 4.0.4, 4.1.2, 4.2.0, 4.3.0, 4.8.4
Last reconfirmed: 2008-04-03 02:56:38


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus F.X.J. Oberhumer 2006-11-14 03:25:40 UTC
// gcc-bug: attribute((sentinel)) warning does not trigger for member function template
//
// how to reproduce: g++-4.1.1 -Wall -c test.cpp
// Markus F.X.J. Oberhumer <markus@oberhumer.com>

#define SENTINEL __attribute__((__sentinel__))

                          void func1(const char *, ...) SENTINEL;
template <class T>        void func2(const T *, ...)    SENTINEL;
                   static void func3(const char *, ...) SENTINEL;
template <class T> static void func4(const T *, ...)    SENTINEL;

struct C {
                          void func1(const char *, ...) SENTINEL;
template <class T>        void func2(const T *, ...)    SENTINEL;
                   static void func3(const char *, ...) SENTINEL;
template <class T> static void func4(const T *, ...)    SENTINEL;
};

static void func3(const char *, ...) { } // definition

void foo(C &c)
{
    func1("a", "b");    // warning here
    func2("a", "b");    // warning here
    func3("a", "b");    // warning here
    func4("a", "b");    // warning here
    c.func1("a", "b");  // warning here
    c.func2("a", "b");  // NO warning here !
    c.func3("a", "b");  // warning here
    c.func4("a", "b");  // NO warning here !
}
Comment 1 Andrew Pinski 2006-11-14 04:34:35 UTC
Confirmed.
Comment 2 Markus F.X.J. Oberhumer 2021-05-27 13:38:25 UTC
This seems to have been fixed in gcc-4.9.
Comment 3 Martin Sebor 2021-05-27 14:41:38 UTC
It was fixed in r203174 committed to fix PR c++/33911 (attribute deprecated vs. templates).