r315366 - Add test for regression caused by reverted patch r315251.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 10 14:07:44 PDT 2017


Author: rsmith
Date: Tue Oct 10 14:07:44 2017
New Revision: 315366

URL: http://llvm.org/viewvc/llvm-project?rev=315366&view=rev
Log:
Add test for regression caused by reverted patch r315251.

Modified:
    cfe/trunk/test/SemaCXX/linkage2.cpp

Modified: cfe/trunk/test/SemaCXX/linkage2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/linkage2.cpp?rev=315366&r1=315365&r2=315366&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/linkage2.cpp (original)
+++ cfe/trunk/test/SemaCXX/linkage2.cpp Tue Oct 10 14:07:44 2017
@@ -218,3 +218,34 @@ namespace PR18964 {
   unsigned &*foo; //expected-error{{'foo' declared as a pointer to a reference of type}}
   extern struct {} *foo; // don't assert
 }
+
+namespace typedef_name_for_linkage {
+  template<typename T> struct Use {};
+
+  struct A { A(); A(const A&); ~A(); };
+
+  typedef struct {
+    A a;
+  } B;
+
+  struct C {
+    typedef struct {
+      A a;
+    } D;
+  };
+
+  typedef struct {
+    void f() { static int n; struct Inner {};}
+  } E;
+
+  // FIXME: Ideally this would be accepted in all modes. In C++98, we trigger a
+  // linkage calculation to drive the "internal linkage type as template
+  // argument" warning.
+  typedef struct {
+    void f() { struct Inner {}; Use<Inner> ui; }
+  } F;
+#if __cplusplus < 201103L
+  // expected-error at -2 {{unsupported: typedef changes linkage of anonymous type, but linkage was already computed}}
+  // expected-note at -5 {{use a tag name here}}
+#endif
+}




More information about the cfe-commits mailing list