r196296 - Issue diagnostic when constructor or destructor

jahanian fjahanian at apple.com
Tue Dec 3 09:42:04 PST 2013


On Dec 3, 2013, at 9:35 AM, Jordan Rose <jordan_rose at apple.com> wrote:

> 
> On Dec 3, 2013, at 9:10 , Fariborz Jahanian <fjahanian at apple.com> wrote:
> 
>> Author: fjahanian
>> Date: Tue Dec  3 11:10:08 2013
>> New Revision: 196296
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=196296&view=rev
>> Log:
>> Issue diagnostic when constructor or destructor
>> return void expression. // rdar://15366494
>> pr17759.
>> 
>> Modified:
>>   cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>>   cfe/trunk/lib/Sema/SemaStmt.cpp
>>   cfe/trunk/test/SemaCXX/return.cpp
>> 
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=196296&r1=196295&r2=196296&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Dec  3 11:10:08 2013
>> @@ -6426,6 +6426,8 @@ def ext_return_has_void_expr : Extension
>> def err_return_init_list : Error<
>>  "%select{void function|void method|constructor|destructor}1 %0 "
>>  "must not return a value">;
>> +def err_ctor_dtor_returns_void : Error<
>> +  "%select{constructor|destructor}1 %0 must not return void expression">;
> 
> Nitpicking: this wording makes it sound like it must return some other kind of expression. How about "...may not return an expression"? Or, if we care about being technically correct, "using an expression with 'return' is not allowed in a %select{constructor|destructor}0”.

There are situations where we issue ExtWarn when a non-void expression is returned. So, I wanted to say ‘void expressions’.
(see ext_return_has_expr).
- Fariborz

> 
> Jordan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131203/fff605e8/attachment.html>


More information about the cfe-commits mailing list