File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -2282,7 +2282,7 @@ bool VarDecl::isUsableInConstantExpressions(ASTContext &Context) const {
2282
2282
// declaration is encountered...
2283
2283
const VarDecl *DefVD = nullptr ;
2284
2284
const Expr *Init = getAnyInitializer (DefVD);
2285
- if (!Init || Init->isValueDependent ())
2285
+ if (!Init || Init->isValueDependent () || getType ()-> isDependentType () )
2286
2286
return false ;
2287
2287
// ... if it is a constexpr variable, or it is of reference type or of
2288
2288
// const-qualified integral or enumeration type, ...
Original file line number Diff line number Diff line change @@ -63,6 +63,14 @@ namespace test5 {
63
63
};
64
64
}
65
65
66
+ namespace test6 {
67
+ template <typename T> T f () {
68
+ const T &v (0 );
69
+ return v;
70
+ }
71
+ int use = f<int >();
72
+ }
73
+
66
74
namespace PR8795 {
67
75
template <class _CharT > int test (_CharT t)
68
76
{
You can’t perform that action at this time.
0 commit comments