This repository was archived by the owner on Aug 31, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -715,6 +715,11 @@ void DeclPrinter::VisitLabelDecl(LabelDecl *D) {
715
715
716
716
void DeclPrinter::VisitVarDecl (VarDecl *D) {
717
717
prettyPrintPragmas (D);
718
+
719
+ QualType T = D->getTypeSourceInfo ()
720
+ ? D->getTypeSourceInfo ()->getType ()
721
+ : D->getASTContext ().getUnqualifiedObjCPointerType (D->getType ());
722
+
718
723
if (!Policy.SuppressSpecifiers ) {
719
724
StorageClass SC = D->getStorageClass ();
720
725
if (SC != SC_None)
@@ -736,11 +741,13 @@ void DeclPrinter::VisitVarDecl(VarDecl *D) {
736
741
737
742
if (D->isModulePrivate ())
738
743
Out << " __module_private__ " ;
744
+
745
+ if (D->isConstexpr ()) {
746
+ Out << " constexpr " ;
747
+ T.removeLocalConst ();
748
+ }
739
749
}
740
750
741
- QualType T = D->getTypeSourceInfo ()
742
- ? D->getTypeSourceInfo ()->getType ()
743
- : D->getASTContext ().getUnqualifiedObjCPointerType (D->getType ());
744
751
printDeclType (T, D->getName ());
745
752
Expr *Init = D->getInit ();
746
753
if (!Policy.SuppressInitializers && Init) {
Original file line number Diff line number Diff line change @@ -228,11 +228,13 @@ template <typename T> struct Foo : T {
228
228
};
229
229
}
230
230
231
- namespace dont_crash {
231
+ namespace dont_crash_on_auto_vars {
232
232
struct T { enum E {X = 12ll }; };
233
233
struct S {
234
234
struct { int I; } ADecl;
235
235
static const auto Y = T::X;
236
236
};
237
237
// CHECK: static const auto Y = T::X;
238
+ constexpr auto var = T::X;
239
+ // CHECK: constexpr auto var = T::X;
238
240
}
You can’t perform that action at this time.
0 commit comments