[PATCH] D53847: [C++2a] P0634r3: Down with typename!

Alan Zhao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 15 10:22:50 PDT 2022


ayzhao added inline comments.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:362
+        // allow this as an extension.
+        if (AllowImplicitTypename == ImplicitTypenameContext::No &&
+            !isClassName && !IsCtorOrDtorName)
----------------
Status update:

This line is currently causing [p2-2.cpp](https://github.com/llvm/llvm-project/blob/main/clang/test/CXX/module/module.interface/p2-2.cpp) to fail with the following error:

```
FAIL: Clang :: CXX/module/module.interface/p2-2.cpp (2 of 17555)
******************** TEST 'Clang :: CXX/module/module.interface/p2-2.cpp' FAILED ********************
Script:
--
: 'RUN: at line 3';   /dev/shm/ayzhao_llvm/llvm-project/build/bin/clang -cc1 -internal-isystem /dev/shm/ayzhao_llvm/llvm-project/build/lib/clang/16.0.0/include -nostdsysteminc -std=c++20 /dev/shm/ayzhao_llvm/llvm-project/clang/test/CXX/module/module.interface/p2-2.cpp -verify
--
Exit Code: 1
 
Command Output (stderr):
--
error: 'error' diagnostics expected but not seen:
  File /dev/shm/ayzhao_llvm/llvm-project/clang/test/CXX/module/module.interface/p2-2.cpp Line 17: cannot export 'iterator' as it is not at namespace scope
  File /dev/shm/ayzhao_llvm/llvm-project/clang/test/CXX/module/module.interface/p2-2.cpp Line 35: cannot export 'iterator' as it is not at namespace scope
error: 'error' diagnostics seen but not expected:
  File /dev/shm/ayzhao_llvm/llvm-project/clang/test/CXX/module/module.interface/p2-2.cpp Line 17: declaration does not declare anything
  File /dev/shm/ayzhao_llvm/llvm-project/clang/test/CXX/module/module.interface/p2-2.cpp Line 35: declaration does not declare anything
4 errors generated.
 
--
 
********************
```

A reduced repro is here:

```
export module X;

export template <typename T>
struct X {
  struct iterator {
    T node;
  };
};

export template <typename T> X<T>::iterator;
```

`Sema::getTypeName(...)` is called from [these lines](https://github.com/llvm/llvm-project/blob/ace05124f5494173ae4769259d49f33d75d6f76b/clang/lib/Parse/ParseDecl.cpp#L3391-L3396), with the result being that `TypeRep` is null in main but not null in this patch.

I'm still in the process of trying to figure out how to resolve this, but any suggestions/insights would be **very** welcome.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53847/new/

https://reviews.llvm.org/D53847



More information about the cfe-commits mailing list