Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
c2693b32
Commit
c2693b32
authored
Jun 14, 2016
by
Branislav Katreniak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
capnpc-c++: fix generated code for union inside template
parent
71c4a06b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
4 deletions
+26
-4
capnpc-c++.c++
c++/src/capnp/compiler/capnpc-c++.c++
+4
-4
encoding-test.c++
c++/src/capnp/encoding-test.c++
+22
-0
No files found.
c++/src/capnp/compiler/capnpc-c++.c++
View file @
c2693b32
...
...
@@ -1134,18 +1134,18 @@ private:
templateContext
.
allDecls
(),
"inline typename "
,
scope
,
titleCase
,
"::Reader "
,
scope
,
"Reader::get"
,
titleCase
,
"() const {
\n
"
,
unionDiscrim
.
check
,
" return "
,
scope
,
titleCase
,
"::Reader(_reader);
\n
"
" return
typename
"
,
scope
,
titleCase
,
"::Reader(_reader);
\n
"
"}
\n
"
,
templateContext
.
allDecls
(),
"inline typename "
,
scope
,
titleCase
,
"::Builder "
,
scope
,
"Builder::get"
,
titleCase
,
"() {
\n
"
,
unionDiscrim
.
check
,
" return "
,
scope
,
titleCase
,
"::Builder(_builder);
\n
"
" return
typename
"
,
scope
,
titleCase
,
"::Builder(_builder);
\n
"
"}
\n
"
,
hasDiscriminantValue
(
proto
)
?
kj
::
strTree
()
:
kj
::
strTree
(
"#if !CAPNP_LITE
\n
"
,
templateContext
.
allDecls
(),
"inline typename "
,
scope
,
titleCase
,
"::Pipeline "
,
scope
,
"Pipeline::get"
,
titleCase
,
"() {
\n
"
,
" return "
,
scope
,
titleCase
,
"::Pipeline(_typeless.noop());
\n
"
" return
typename
"
,
scope
,
titleCase
,
"::Pipeline(_typeless.noop());
\n
"
"}
\n
"
"#endif // !CAPNP_LITE
\n
"
),
templateContext
.
allDecls
(),
...
...
@@ -1166,7 +1166,7 @@ private:
}
KJ_UNREACHABLE
;
},
" return "
,
scope
,
titleCase
,
"::Builder(_builder);
\n
"
" return
typename
"
,
scope
,
titleCase
,
"::Builder(_builder);
\n
"
"}
\n
"
)
};
}
...
...
c++/src/capnp/encoding-test.c++
View file @
c2693b32
...
...
@@ -1851,6 +1851,28 @@ TEST(Encoding, GenericDefaults) {
.
getValue
().
getRev
().
getFoo
().
getInt16Field
());
}
TEST
(
Encoding
,
UnionInGenerics
)
{
MallocMessageBuilder
message
;
auto
builder
=
message
.
initRoot
<
test
::
TestGenerics
<>>
();
auto
reader
=
builder
.
asReader
();
//just call the methods to verify that generated code compiles
reader
.
which
();
builder
.
which
();
reader
.
isUv
();
builder
.
isUv
();
reader
.
getUv
();
builder
.
getUv
();
builder
.
setUv
();
reader
.
isUg
();
builder
.
isUg
();
reader
.
getUg
();
builder
.
getUg
();
builder
.
initUg
();
}
}
// namespace
}
// namespace _ (private)
}
// namespace capnp
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment