[cfe-dev] PCH serialization issues (PR 34728)
Steve O'Brien via cfe-dev
cfe-dev at lists.llvm.org
Tue Sep 26 18:56:26 PDT 2017
I'm running into trouble when serializing a template function
declaration to PCH and subsequently reading it back:
https://bugs.llvm.org/show_bug.cgi?id=34728
Small example:
header.h
--
template <int i=42, class T> int f(T const&);
template <int i, class T> int f(T const&) {return i;}
main.cpp
--
int main(int, char**) {return f(3.14);}
An error is reported that the value for `i` could not be deduced,
because in the AST -> PCH -> AST conversions the default value `42` is
lost.
I am just now finishing up a patch which adds one more item to the
serialized output for these template types, indicating the decl (with
`Record.AddDeclRef`) inherited from if present.
This seems to be working: fixes the errors seen in my repro (see
bugzilla link above for the repro patch), and the changes seem mostly
clean. :)
Does this approach sound ok in theory?
Thanks!
--steveo
More information about the cfe-dev
mailing list