You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Zezeng Wang (Jira)" <ji...@apache.org> on 2020/04/01 16:19:00 UTC

[jira] [Commented] (THRIFT-2374) No code generated for defaults when complex constants are referenced

    [ https://issues.apache.org/jira/browse/THRIFT-2374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17072929#comment-17072929 ] 

Zezeng Wang commented on THRIFT-2374:
-------------------------------------

 *The problem can be solved by testing against {{CV_IDENTIFIER}} and proper treatment of that special case in all of the affected places.*

 

Hi [~jensg], I look through the t_cpp_generator.cc  file, it doesn't exist *{{CV_IDENTIFIER}}* , ** maybe I don't get your point about this issue. My idea is to solve it by add the code generated to assign the {{GEN_WHAT}} constant in the Default constructor(just consider cpp generator part). Can you give me some advice ? Looking forward to your reply  ^_^.

 

> No code generated for defaults when complex constants are referenced
> --------------------------------------------------------------------
>
>                 Key: THRIFT-2374
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2374
>             Project: Thrift
>          Issue Type: Bug
>          Components: C# - Compiler, C++ - Compiler, Compiler (General), Delphi - Compiler
>            Reporter: Jens Geyer
>            Priority: Major
>
> The assignment of more complex constants looks like not fully implemented. Here's a test case:
> {code:title=testcase.thrift}
> struct thing {
>   1: i32 hello,
>   2: i32 goodbye
> }
> const map<i32,thing> GEN_WHAT = { 35 : { 'hello' : 325, 'goodbye' : 325352 } }
> struct Foo {
>   1:  map<i32,thing> complex = GEN_WHAT
> }
> service Bar {
>   void Baz( 4: map<i32,thing> complex = GEN_WHAT)
> }
> {code}
> At least for the languages I tested (C++, C# and Delphi) there is no code generated to assign the {{GEN_WHAT}} constant at all, altough it is used at two places in the IDL. I have not checked all the other languages, but there are very likely some more candidates around. The problem can be solved by testing against {{CV_IDENTIFIER}} and proper treatment of that special case in all of the affected places. 
> *Remarks:*
>  * Regarding the service args, there's a general problem for which another ticket exists: THRIFT-2315. 
>  * I already fixed the HTML compiler with THRIFT-2370.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)