Bug 37653 - Duplicate messages and warnings depending on the program
Summary: Duplicate messages and warnings depending on the program
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-26 01:30 UTC by Sumant Tambe
Modified: 2011-09-29 00:11 UTC (History)
1 user (show)

See Also:
Host: x86-linux-gnu (Red Hat 4.1.2-33)
Target: x86-linux
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 Sumant Tambe 2008-09-26 01:30:08 UTC
template <char I>
struct Int2Type
{
    enum { value = I };
    typedef Int2Type<I> type;
    typedef typename Int2Type<I+1>::type next;
};
int main(void)
{
    Int2Type<5> i;
}
g++ compiler compiles the above program successfully (as it should) but spits out the same warning message 5 times. If you change digit 5 in main to say 7, it spits out 7 identical warnings! Essentially, the warnings are repeated as many number of times as the integer parameter to the Int2Type template. Please try  g++ "source-file" -o "output-file" -Wall 2>&1 | grep warning
Comment 1 Andrew Pinski 2008-09-26 01:33:48 UTC
Works correctly on the trunk, that is it does not warn at all.
Comment 2 Andrew Pinski 2008-10-03 20:56:02 UTC
(In reply to comment #1)
> Works correctly on the trunk, that is it does not warn at all.

Well with -pedantic it does warn.
Comment 3 Paolo Carlini 2011-09-29 00:11:07 UTC
Fixed in 4.6.x.