LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 11609 - missing warning for ambiguous else
Summary: missing warning for ambiguous else
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: Frontend (show other bugs)
Version: unspecified
Hardware: PC Linux
: P enhancement
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-18 11:32 PST by Rafael Ávila de Espíndola
Modified: 2011-12-22 17:26 PST (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments
possible patch (9.72 KB, patch)
2011-12-20 00:26 PST, Nico Weber
Details
with actual test (10.05 KB, patch)
2011-12-20 00:31 PST, Nico Weber
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Ávila de Espíndola 2011-12-18 11:32:15 PST
gcc will warn on

void g(int);
void f(int a, int b) {
        if (a)
                if (b)
                        g(1);
                else
                        g(2);
        g(3);
}

but clang doesn't.
Comment 1 Nico Weber 2011-12-20 00:26:09 PST
Created attachment 7765 [details]
possible patch

Based on http://drdobbs.com/blogs/cpp/231602010

I didn't evaluate the usefulness of this warning yet.
Comment 2 Nico Weber 2011-12-20 00:31:11 PST
Created attachment 7766 [details]
with actual test
Comment 3 Nico Weber 2011-12-20 15:33:35 PST
Sent out for review: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20111219/050474.html
Comment 4 Nico Weber 2011-12-22 17:26:37 PST
r147202