[PATCH] D43320: Allow dllimport non-type template arguments in C++17

2018-05-10 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment. Thanks for the guidance! Comment at: clang/lib/AST/ExprConstant.cpp:1871-1902 if (!CheckConstantExpression(Info, DiagLoc, EltTy, Value.getArrayInitializedElt(I))) return false; } if

[PATCH] D43320: Allow dllimport non-type template arguments in C++17

2018-05-10 Thread Reid Kleckner via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC332018: Allow dllimport non-type template arguments in C++17 (authored by rnk, committed by ). Changed prior to commit: https://reviews.llvm.org/D43320?vs=146039=146178#toc Repository: rC Clang

[PATCH] D43320: Allow dllimport non-type template arguments in C++17

2018-05-09 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision. rsmith added inline comments. This revision is now accepted and ready to land. Comment at: clang/lib/AST/ExprConstant.cpp:1871-1902 if (!CheckConstantExpression(Info, DiagLoc, EltTy,

[PATCH] D43320: Allow dllimport non-type template arguments in C++17

2018-05-09 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added inline comments. Comment at: clang/include/clang/AST/Expr.h:662 + /// Indicates how the constant expression will be used. + enum ConstExprUsage { EvaluateForCodeGen, EvaluateForMangling }; + I expect we could come up with a better name, but is this

[PATCH] D43320: Allow dllimport non-type template arguments in C++17

2018-05-09 Thread Reid Kleckner via Phabricator via cfe-commits
rnk updated this revision to Diff 146039. rnk added a comment. - getting closer https://reviews.llvm.org/D43320 Files: clang/include/clang/AST/Expr.h clang/lib/AST/ExprConstant.cpp clang/lib/Sema/SemaOverload.cpp clang/test/SemaCXX/dllimport-constexpr.cpp

[PATCH] D43320: Allow dllimport non-type template arguments in C++17

2018-05-09 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: clang/include/clang/AST/Expr.h:670-672 + /// Evaluate an expression that is required to be a core constant expression. + bool EvaluateAsCoreConstExpr(EvalResult , QualType ParamType, + CCEKind CCE, const

[PATCH] D43320: Allow dllimport non-type template arguments in C++17

2018-05-09 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added inline comments. Comment at: clang/include/clang/AST/Expr.h:670-672 + /// Evaluate an expression that is required to be a core constant expression. + bool EvaluateAsCoreConstExpr(EvalResult , QualType ParamType, + CCEKind CCE, const

[PATCH] D43320: Allow dllimport non-type template arguments in C++17

2018-05-09 Thread Reid Kleckner via Phabricator via cfe-commits
rnk updated this revision to Diff 146025. rnk added a comment. - don't expose CCEK, use a bool https://reviews.llvm.org/D43320 Files: clang/include/clang/AST/Expr.h clang/lib/AST/ExprConstant.cpp clang/lib/Sema/SemaOverload.cpp clang/test/SemaCXX/dllimport-constexpr.cpp

[PATCH] D43320: Allow dllimport non-type template arguments in C++17

2018-02-15 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: clang/include/clang/AST/Expr.h:103 +/// Contexts in which a converted constant expression is required. +enum CCEKind { + CCEK_CaseValue, ///< Expression in a case label. If we end up moving this out of `Sema` into the

[PATCH] D43320: Allow dllimport non-type template arguments in C++17

2018-02-15 Thread Reid Kleckner via Phabricator via cfe-commits
rnk updated this revision to Diff 134510. rnk added a comment. - revise as discussed https://reviews.llvm.org/D43320 Files: clang/include/clang/AST/Expr.h clang/include/clang/Sema/Sema.h clang/lib/AST/ExprConstant.cpp clang/lib/Sema/SemaOverload.cpp

[PATCH] D43320: Allow dllimport non-type template arguments in C++17

2018-02-15 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added inline comments. Comment at: clang/lib/AST/ExprConstant.cpp:10166-10182 +EvalInfo Info(Ctx, Result, EvalInfo::EM_ConstantFold); +Info.IsNonTypeTemplateArgument = true; +LValue LV; +if (!EvaluateLValue(this, LV, Info) || Result.HasSideEffects || +

[PATCH] D43320: Allow dllimport non-type template arguments in C++17

2018-02-14 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: clang/lib/AST/ExprConstant.cpp:10166-10182 +EvalInfo Info(Ctx, Result, EvalInfo::EM_ConstantFold); +Info.IsNonTypeTemplateArgument = true; +LValue LV; +if (!EvaluateLValue(this, LV, Info) || Result.HasSideEffects || +

[PATCH] D43320: Allow dllimport non-type template arguments in C++17

2018-02-14 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: clang/lib/AST/ExprConstant.cpp:10166-10182 +EvalInfo Info(Ctx, Result, EvalInfo::EM_ConstantFold); +Info.IsNonTypeTemplateArgument = true; +LValue LV; +if (!EvaluateLValue(this, LV, Info) || Result.HasSideEffects || +

[PATCH] D43320: Allow dllimport non-type template arguments in C++17

2018-02-14 Thread Reid Kleckner via Phabricator via cfe-commits
rnk created this revision. rnk added a reviewer: rsmith. When the C++ committee changed the wording around non-type template arguments, they naively thought that every global declarations address would be a constant expression, but this is not the case. There is no PE/COFF relocation that allows