balazske added inline comments.
================ Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:747 + : *FilePtrTy) + : None; + ---------------- martong wrote: > balazske wrote: > > The `Optional<QualType>` can be left out from the right side expressions > > (in the `?` operator part). (A `QualType` should be assignable to > > `Optional<QualType>`.) > No that cannot be left out. Implicit conversion does not play when trying to > determine the common type for the 2nd and 3rd argument of the ternary op. > https://stackoverflow.com/questions/32251419/c-ternary-operator-conditional-operator-and-its-implicit-type-conversion-r > So, removing the explicit type I get a compile error. Still I do not like that code. Probably this is better then: ``` Optional<QualType> FilePtrTy, FilePtrRestrictTy; if (FileTy) { FilePtrTy = ACtx.getPointerType(*FileTy); FilePtrRestrictTy = ACtx.getLangOpts().C99 ? ACtx.getRestrictType(*FilePtrTy) // FILE *restrict : *FilePtrTy) } ``` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80016/new/ https://reviews.llvm.org/D80016 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits