
This patch fixes a crash due to following simple program: > export struct Unit { > bool operator<(const Unit&); > }; It would crash since the compiler would set the module ownership for Unit. And the declaration with a module ownership is assumed to own a module. But here isn't one. So here is the crash. This patch fixes this by exiting early if it finds the export decl is already invalid. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D117093
5 lines
229 B
C++
5 lines
229 B
C++
// RUN: %clang_cc1 -std=c++20 %s -fsyntax-only -verify
|
|
export struct Unit { // expected-error {{export declaration can only be used within a module interface unit after the module declaration}}
|
|
bool operator<(const Unit &);
|
|
};
|