On Jan 14, 2009, at 3:24 PM, Douglas Gregor wrote:
>>> +/// @brief Determine the result of name lookup.
>>> +Sema::LookupResult::LookupKind Sema::LookupResult::getKind()
>>> const {
>>> + switch (StoredKind) {
>>> + case SingleDecl:
>>> + return (reinterpret_cast<Decl *>(First) != 0)? Found :
>>> NotFound;
>>> +
>>> + case OverloadedDeclFromIdResolver:
>>> + case OverloadedDeclFromDeclContext:
>>> + return FoundOverloaded;
>>> +
>>> + case AmbiguousLookup:
>>> + return Ambiguous;
>>> + }
>>> +
>>> + // We can't get here, but GCC complains nonetheless.
>>> + return Ambiguous;
>>> +}
>>>
>>
>> I believe our standard way of handling this is by having a default
>> case
>> that asserts.
>>
>> switch (StoredKind) {
>> default: assert(false && "Bad StoredKind");
>
> IIRC, I was getting bogus "function does not return a value" warnings
> from GCC when I've done this.
Make sure the default case is at the start of the switch (Before the
first case) not at the end.
-Chris
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits