Skip to content

Commit bd2d98e

Browse files
committed
---
yaml --- r: 347247 b: refs/heads/master c: cf379be h: refs/heads/master i: 347245: c459bc8 347243: 2e99191 347239: 4e5a2e5 347231: 3e9adf0
1 parent 42980f1 commit bd2d98e

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 501fa43c4d2713f6d20a4e9047b781d40eaab91a
2+
refs/heads/master: cf379beb9df5e9470fb416ebf0eb580e51699320
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/Sema/DerivedConformanceRawRepresentable.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,11 @@ static bool canSynthesizeRawRepresentable(DerivedConformance &derived) {
501501
// - the enum elements all have the same type
502502
// - they all match the enum type
503503
for (auto elt : enumDecl->getAllElements()) {
504+
// We cannot synthesize raw representable conformance for an enum with
505+
// cases that have a payload.
506+
if (elt->hasAssociatedValues())
507+
return false;
508+
504509
tc.validateDecl(elt);
505510
if (elt->isInvalid()) {
506511
return false;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: not %target-swift-frontend -typecheck %s
2+
3+
// Just make sure we don't crash.
4+
5+
enum Crash: String {
6+
case foo
7+
case bar(String)
8+
9+
static let shared = Crash()
10+
}
11+
12+
extension Crash {
13+
init() { self = .foo }
14+
}

0 commit comments

Comments
 (0)